By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

Database abstraction (like AdoDB in PHP)

P: n/a
Is there something like ADODB in PHP for Python? something that would
allow me to easily switch databases just by changing a few parameters?
:)

- Andres
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
DH
Andres Montiel wrote:
Is there something like ADODB in PHP for Python? something that would
allow me to easily switch databases just by changing a few parameters?
:)


The person who wrote ADODB made a version for Python, too, recently:
http://php.weblogs.com/adodb_python

But see also:
http://sqlobject.org/
http://modeling.sourceforge.net/
and some commercial products like Rekall, mxODBC
Jul 18 '05 #2

P: n/a
DH a crit :
Andres Montiel wrote:
Is there something like ADODB in PHP for Python? something that would
allow me to easily switch databases just by changing a few parameters?
:)

The person who wrote ADODB made a version for Python, too, recently:
http://php.weblogs.com/adodb_python

But see also:
http://sqlobject.org/
http://modeling.sourceforge.net/
and some commercial products like Rekall, mxODBC


In fact, this is nearly already the case. If your library is "Python
Database API Specification v2.0" compliant (see
http://www.python.org/peps/pep-0249.html) then you can just change the
connection object. But you need to take care of such thing like the
"paramstyle" parameters.
I've already use this to change from MySQL to ODBC with no change in the
code.

But the real pain is not the API, it is the SQL. For example an integer
will not be declare the same way in PostGres or MySQL, same for BLOB, etc.

That is why the only way is to do things in a more abstract way like
sqlobject or modeling. But I find it is still complicate to have a
persistent framework that can accept Database, ZODB, etc in a nice way...

Loc

Jul 18 '05 #3

P: n/a
Thanks for the tips. :)

On Fri, 2004-02-20 at 05:50, Yermat wrote:
DH a écrit :
Andres Montiel wrote:
Is there something like ADODB in PHP for Python? something that would
allow me to easily switch databases just by changing a few parameters?
:)

The person who wrote ADODB made a version for Python, too, recently:
http://php.weblogs.com/adodb_python

But see also:
http://sqlobject.org/
http://modeling.sourceforge.net/
and some commercial products like Rekall, mxODBC


In fact, this is nearly already the case. If your library is "Python
Database API Specification v2.0" compliant (see
http://www.python.org/peps/pep-0249.html) then you can just change the
connection object. But you need to take care of such thing like the
"paramstyle" parameters.
I've already use this to change from MySQL to ODBC with no change in the
code.

But the real pain is not the API, it is the SQL. For example an integer
will not be declare the same way in PostGres or MySQL, same for BLOB, etc.

That is why the only way is to do things in a more abstract way like
sqlobject or modeling. But I find it is still complicate to have a
persistent framework that can accept Database, ZODB, etc in a nice way...

Loïc

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.