Is Python DB-API 2.0 for relational database only, or also for some nonrelational databases?
https://wiki.python.org/moin/DatabaseInterfaces seems to imply no.
https://wiki.python.org/moin/DatabaseProgramming seems to imply yes.
Thanks.
Is Python DB-API 2.0 for relational database only, or also for some nonrelational databases?
https://wiki.python.org/moin/DatabaseInterfaces seems to imply no.
https://wiki.python.org/moin/DatabaseProgramming seems to imply yes.
Thanks.
Although the DatabaseProgramming link you provided considers DB-API an interface specification for relational databases, I do not see where the actual PEP 249 would make any restriction to a certain type of DB engine/architecture. However, both, the wiki page and the PEP have been authored by Marc-André Lemburg, so he might have written the PEP with mainly relational databases in mind.
From my point of view, the interface specification is abstract enough to also fit non-relational data sources. As a matter of fact, I once wrote an adapter for a Rest-API in front of a huge mongo database. That adapter widely implemented DB-API 2.0 in order to unify access to data from various sources (ODBC, JDBC, the said mongo DB behind the Rest service).
I would argue that, if a developer sees benefit in implementing access to a data source following the DB-API 2.0 specs and he does so consistently, there's no reason why such an implementation should be considered wrong or un-pythonic.
I mean, one could even wrap access to file objects in DB-API compliant constructs without making it look completely stupid or fully useless ...