Postgres and other database interfaces

Joe jma at freedomcircle.com
Sat Feb 24 20:45:03 UTC 2018


On Saturday, 24 February 2018 at 18:56:23 UTC, Denis F wrote:
> It seems to me that this is a common misconception that it is 
> possible to create a good universal tool for accessing the 
> database in place of the many existing ones.

I don't think what is needed a "good universal tool" but a good 
enough common interface. Python PEP 249 is very similar to what 
I've seen in the D libraries I've looked at: there is a 
Connection class of some kind, and a Cursor (or command or query) 
class, each with a set of well-defined (and generally not 
unexpected) methods: commit/rollback on the connection, 
execute/fetch/etc. on the cursor). PEP 249 also standardizes the 
exceptions and some datatypes.

It's not perfect, or universal enough, but I believe it allowed 
db development under Python to proceed at a faster pace than 
otherwise. There's a similar story on the web side. When Django 
first came out, IIRC it had its own interface, but then the WSGI 
standard came out (PEP 333) and every Python web framework 
including Django moved to it (it also resulted in a proliferation 
of frameworks, but that's another story). And WSGI even 
influenced Ruby's Rack and other such interfaces.

Joe


More information about the Digitalmars-d mailing list