The Best? I don't know but I am very happy with:
- Firebird 1.5rc2 db - http://firebird.sourceforge.net/
- they also have an embedded version - small foot print, but haven't tried this out yet
- kinterbasdb, python DBA for above - http://kinterbasdb.sourceforge.net/
- ORM, an Object Relational Membrane - Wiki
- FixedPoint - http://fixedpoint.sourceforge.net/
- For numeric columns
I use all this for a smallish application, so don't know how it would work in heavy multi user scenario.
Using ORM (supports also MySQL and PostGreSGL) lets you write code without having to worry too much about SQL syntax.
See you
Werner
*A little sample:*
*The db Table declaration:*
create = """
CREATE TABLE test1 (
id INTEGER,
str VARCHAR(100),
f FLOAT,
i INTEGER,
l NUMERIC(18,1),
b CHAR(1),
u VARCHAR(100),
na NUMERIC(10,1),
nb NUMERIC(10,2),
nc NUMERIC(10,3),
nd NUMERIC(5,2),
unic VARCHAR(50) CHARACTER SET UNICODE_FSS,
mydatestamp TIMESTAMP,
mydate DATE
)
"""
ds.execute(create)
ds.commit()
*The table defined as a class:*
class test1(dbclass):
tableName = "TEST1"
primaryKey = "id"
columns = {"id": gen(columnName="ID"),
"str": varchar(columnName="STR"),
"f": float(columnName="F"),
"i": integer(columnName="I"),
"l": numeric(columnName="L"),
"b": boolean(columnName="B"),
"u": varchar(columnName="U"),
"na": numeric(columnName="NA"),
"nb": numeric(columnName="NB"),
"nc": numeric(columnName="NC"),
"nd": numeric(columnName="ND"),
"unic": Unicode(columnName="UNIC"),
"mydatestamp": datetime(columnName="MYDATESTAMP"),
"mydate": varchar(columnName="MYDATE")
}
*Now write and read from it:*
t = test1(str="Diedrich", i=1, f=33.1415, u="üöäöüöÜÖÄ?", l=123456789012345., b=1, na=1.0, unic="\xe1\xe8\xee\xf5",
mydatestamp=somedatestamp , mydate=somedate)
ds.insert(t)
ds.commit()
t.str = "Claudia"
t.b = 0
t.u = "Hallo Welt!"
t.f = 0.4321225
t.unic = u'äÄööÖüÜßèñÛ'
t.na = '123456789.1'
t.nb = '12345678.12'
t.nc = '1234567.123'
t.nd = '123.12'
t.i = 1
ds.commit()
s = test1(str="Mike", i=None, l=347678346238746.,
b=2, u="fjhsdf", unic='áèîõ')
ds.insert(s)
ds.commit()
s.b = 50
s.u = "something"
ds.commit()
t = ds.selectByPrimaryKey(test1, 1)
print '\n\nfirst row from db'
print t
print "string =" + t.str
print "string repr=" + repr(t.str)
print ("i = %i" % t.i)
print ("l = %f" % t.l)
print ("b = %s" % t.b)
print ("f = %f" % t.f)
print ("u = %s" % t.u)
print ("unic = %s" % repr(t.unic)) # the repr does the trick, since Unicode
# usually can't be printed to stdout
# without UnicodeError
print ("unic = %s" % t.unic) #
print ("ta = %f" % t.na)
print ("tb = %f" % t.nb)
print ("tc = %f" % t.nc)
print ("td = %f" % t.nd)
print ("mydate = %s" % t.mydate)
print ("mydatestamp = %s" % t.mydatestamp)
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?
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