Python and Sybase
John J. Lee
jjl at pobox.com
Sat Sep 25 08:17:14 EDT 2004
aleaxit at yahoo.com (Alex Martelli) writes:
> Josh Close <narshe at gmail.com> wrote:
>
> > > Also, is there any module that provides a generic DB API and can be
> > > hooked to both Sybase and postgresql? This
> > > (http://www.python.org/peps/pep-0249.html) looks pretty old.
> >
> > Why would you need that? Python has a DB API, so all you have to do to
> > change from db to db is the connection string.
> >
> > conn = Sybase.connection(.....)
> > conn = otherModules.connection(....)
> >
> > Everthing else should work the same way.
>
> ...except that you may need to use different placeholders in SQL strings
> for parameters to insert (sigh)...
...and there are of course variations in SQL from DBMS to DBMS...
IIRC, Steve Holden suggests in his book [1] the use of
internationalization (i18n) tools (eg. gettext) to make DB API code
portable. Seems unfortunately apt.
[1] "Python Web Programming", New Riders (2002)
John
More information about the Python-list
mailing list