[DB-SIG] URI syntax for databases
Ian Bicking
ianb at colorstudy.com
Thu Mar 31 22:48:54 CEST 2005
Dittmar, Daniel wrote:
>>In the end, I think it's more efficient to implement such
>>a function in an abstraction layer which is maintained
>>independently from the DB-API database modules. Otherwise,
>>you'd have to wait for all modules to implement the change
>>and that can take a few years.
>
>
> Perhaps the abstraction layer should look for <module>.uri_connect. If
> this function cannot be found, then a database specific translation of
> uri to connect () is used. Otherwise, changes to the driver specific
> connect would also require changes to the abstraction layer connect.
This is probably what I'd end up doing -- obviously I can't change the
code that's out there, and I want to use this relatively recently.
Mostly I'm just hoping for a convention that other's can follow, until
this transitional module is no longer necessary.
> An alternative would be to always use uri_connect. In addition, a set of
> modules is provided that implements this uri translation for older
> drivers. The user would then have to choose between the real module or
> the translation module.
That seems awkward, but I suppose doable. That translating module would
also have to include the rest of the required functions if it was to be
a DB-API module. Monkey-patching in a uri_connect function seems
easier, if we're going down that route. Hmm... except you can't monkey
patch something in lazily -- i.e., wait until the user actually imports
MySQLdb and then insert the function.
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the DB-SIG
mailing list