From: Visgean Skeloru <visg...@gmail.com> To: sqlobject-discuss@lists.sourceforge.net Date: Tuesday 13 April 2010 > Hello is it possible to set a specific connections database for each class? > > because i have 2 class and one of them is temporary so i would like to use > sqlite in memory.
Yes, it's possible. One way is to pass a connection parameter at class creation (that's at least the way I do it). This may look like: from sqlobject import SQLObject, connectionForURI class AnObject(SQLObject): one_attr = StringCol() con = connectionForURI("sqlite:/:memory:") obj = AnObject(one_attr="one attr", connection=con) The other way is defining the _connection attribute on the class definition. I have never tried it but from reading the doc I think I remember it quite like this: con = connectionForURI("sqlite:/:memory:") class AnObject(SQLObject) one_attr = StringCol() _connection = con With the first one you have to keep in mind to pass the connection parameters in later operations, such as select (again, that's at least the way I do it). I have never fiddled with the second one, so I can't provide some experience on the matter. Please do post your results :) Cheers Juan Manuel Santos ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss