On Mon, Jan 28, 2008 at 11:22:14PM +0100, Frank Wagner wrote:
> AttributeError: No connection has been defined for this thread or process
You have to open a connection to the DB before you could run a query.
You can declare the connection as a string:
__connection__ = "sqlite:///path/to/database.db"
before any SQLObject class in the module. Or you can set the connection
string for an every class:
MyTable.setConnection("sqlite:///path/to/database.db")
or you can open a connection
connection = sqlobject.connectionForURI("sqlite:///path/to/database.db")
and set it globally:
sqlobject.sqlhub = connection
or locally:
MyTable.setConnection(connection)
or you can pass the connection (only real connection, not a DB URI
string) to every method:
MyTable.select(clause, ..., connection=connection)
And, BTW, you can open a transaction from the connection.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss