Mike Driscoll ha scritto:
Hi,
I was thinking about refactoring my database access within one of my
complex wxPython programs by using a Python ORM. The only one I've found
that works with the legacy databases I deal with is SqlAlchemy. I was
wondering if anyone has some sample code that combines the two. All I can
find is this:
Interesting use of the pyprocessing package, it would be good to know
which best way to handle multiple processes is available today in python
(or wxPython).
As for SQLAlchemy + wxpython, that's what I was unaware of in my first attempt:
I use a session to load data into a mapped class, the class fields are loaded into a gui and changed by the user, later with the same session I do a session.update(myMappedClass) and only the changed fields get written to the database(changed = their value is different than what it was when loaded into the session). This is a SQLAlchemy session.update() behaviour you could miss at a first glance.
To avoid problems with concurrent updates you'll have to implement something like this if you'll use the one session approach:
http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg05208.html