Best opensource database module for wxPython ?

Hello!

I use sqlite and pysqlite.

http://www.sqlite.org (I typed this from memory, I think it is right)
http://pysqlite.sourceforge.net

Sqlite is not a full-blown database server, but it may fit your needs. It
has a DB-API 2.0 compliant (well, pretty compliant, I think) driver. So,
your code should run the same on linux / windows. Also, if I'm not
mistaken, you can take the database file and use it on different platforms.

Its nice and free. Here is some code I use:

···

####

import sqlite

conn = sqlite.connect( db_full_path )
cursor = conn.cursor()
cursor.execute( """
                CREATE TABLE SCORES (
                  QUIZ_ID INT NOT NULL,
                  SCORE INT NOT NULL,
                  DATE TIMESTAMP NOT NULL,
                  TIME_TAKEN INT NOT NULL )""" )

cursor.execute( """
                CREATE INDEX SCORES_DATE_IDX on SCORES (DATE)
                """ )

conn.commit()
conn.close()

# Grabbing data is just as simple...
# This is off the top of my head (scary place for code)
conn = sqlite.connect( db = "/path/to/my/db.file" )
curs = conn.cursor()
curs.execute( "SELECT * FROM SOME_TABLE" )

row = curs.fetchone()
while row:
  print row[0] # First column
  print row.my_column # Assuming you have a column named "my_column"
  row = curs.fetchone()

## End code

Good luck with it. Read up on sqlite, it *may* not be what your looking
for. (All data except for integer primary keys are stored as strings).

jw

-----Original Message-----
From: Aplin, Neo [mailto:Neo.Aplin@team.telstra.com]
Sent: Tuesday, September 02, 2003 11:28 PM
To: wxPython-users@lists.wxwindows.org
Subject: [wxPython-users] Best opensource database module for
wxPython?

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?

BTW: I've not looked into mxODBC as I need 100% opensource tools.

Thanks in advance,

Neo.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwindows.org