[orm-devel] Unified Connection Strings

Julio Rommi Oņa Miranda orm-devel@mailman.tux4web.de
Thu, 5 Dec 2002 01:14:41 -0400


Hi everyone,

El Dom 01 Dic 2002 08:04, escribiķ:
>
> Does anyone know who else is using this url style notation? Is there
> a standard like an RFC or so? Do you think it's worth the effort to
> support both?
>
> Any comment is very welcome!
>
> Diedrich

I was reviewing some documentation this time (DivePython indeed), and I've 
saw how to concatenate strings and use optional arguments... so I recall how 
datasource is called when a selections is maded. If you look there could be 
use the same way to open a connection:

ds= datasource(driver="pgsql", user="me", 
password="thispassword",dbname="test",host="myhost")

and with this datasource shoud create the dns string needed to connect to the 
postgrest server: "user=me password=thispassword dbname=test host=myhost".

In the same way if we say:

ds1= datasource(driver="mysql", user="me", 
password="thispassword",dbname="test",host="myhost")

the datasource clase shoud translate the parameters to user, passwd, db, host 
and create the requested structure to call the mysql server.

Datasource shoud request the needed information to connect a database type 
and ignore the suplementary information that is no needed by others.

Including driver as a parameter allows us to have more than a database source 
(and type). Of course, datasource class logic should take this on account and 
search the driver in the orm path, in other words when "mysql" is gived to 
it, then mysql modules (in the mysql dir) shoud be imported.

This has an implication on column classes, so they shoud be generic respect 
the database so orm dbclass use the respective column/columndata classes 
depending the driver used.

Ok, just a little idea, (you can flame me if you want ;-P

Regards.


-- 
Julio