On Feb 20, 2006, at 9:37 PM, Marko Mikulicic wrote:
2) creating a wrapper for engine that proxies itself to the correct
engine appropriated for the current request. However
I'm not sure whether the engine object is traversed for each
access to the connection or some attributes of the connection are
saved inside
table,mapper etc objects
youre looking for the ProxyEngine : http://www.sqlalchemy.org/docs/
dbengine.myt#dbengine_proxy
(never knew it would be so popular so quick....)
Also changing the underlining connection/engine may intefere with
the objectstore? What should I do before and after a request
processing (assuming request doesn't span connection boundaries) in
order to insure consistency without too much overhead?
youre going to be setting up the ProxyEngine connect() each time you
deal with a new request. at the very same time, do an
objectstore.clear() which will give you a brand new unit of work
session. you want to start with a blank Session for each request so
thats the way to go. both operations (ProxyEngine, objectstore)
operate on internal instances that are keyed off the current thread
ID so they are local to the current thread.
at the end of a request, you might want to do an objectstore.commit
(), but only if you think there might be un-persisted objects lying
around that you want to be saved.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users