Best opensource database module for wxPython?

Aplin, Neo wrote:

Hi guys,

What is the best opensource database module for wxPython? I'm about to write a wxPython app to use MSSQL (win) and PostgreSQL (linux), and would like to write the code once, for both databases.

I see that there is no wxODBC mapping for wxPython. One of the few posts I've seen on this say that this is because there is enough database bindings for Python...but they seem to be platform and/or database specific (negating the use of a non-platform, non-database tool such as wxODBC, or so I thought..).

- Is there a wxPython binding for wxODBC? - What would it take to get wxODBC working for wxPython? Would this involve, say, SWIG?

Code for accessing a database is in no way related to your GUI-code,
so you should keep this strictly separate. This means you can
and you should use the python modules for database access, and
not any wx modules.

There are several database modules (also called database adapters=DBA)
available for python, most of them are conformant to a python standard
called DB API 2.0. In principle, it should be possible
to replace one DBA by another without changing any line of code.

Most DBA contain some C-code, thus installing them on different
operating systems is not always possible. I use 'psycopg' for
accessing postgres, but this DBA is NOT available on windows.
However, there are other DBA around, which can be used on windows.
For windows I have done some trials with 'pyPgSQL'.

In order to make your python code as less dependend on your DBA as
possible, you should import the dba with an alias name. If you do
so, you just have to change the import line, when you want
to employ another DBA:

   import psycopg as dba # assign alias name 'dba'
   #import pyPgSQL.PgSQL as dba # assign alias name 'dba'

   connectObj = dba.connect("dbname=%s user=%s host=%s" % (DB_NAME,DB_USER,DB_HOST))

···

--

Peter
-------------------------------------------------------------------
Peter Slickers piet@clondiag.com
Clondiag Chip Technologies http://www.clondiag.com/
Löbstedter Str. 105
07749 Jena
Germany

Fon: 03641/5947-65 Fax: 03641/5947-20
-------------------------------------------------------------------