sqlobject.dbconnection module¶
-
class
sqlobject.dbconnection.
Boolean
[source]¶ Bases:
object
A bool class that also understands some special string keywords
Understands: yes/no, true/false, on/off, 1/0, case ignored.
-
class
sqlobject.dbconnection.
ConnWrapper
(soClass, connection)[source]¶ Bases:
object
This represents a SQLObject class that is bound to a specific connection (instances have a connection instance variable, but classes are global, so this is binds the connection variable lazily when a class method is accessed)
-
class
sqlobject.dbconnection.
ConnectionHub
[source]¶ Bases:
object
This object serves as a hub for connections, so that you can pass in a ConnectionHub to a SQLObject subclass as though it was a connection, but actually bind a real database connection later. You can also bind connections on a per-thread basis.
You must hang onto the original ConnectionHub instance, as you cannot retrieve it again from the class or instance.
To use the hub, do something like:
hub = ConnectionHub() class MyClass(SQLObject): _connection = hub hub.threadConnection = connectionFromURI('...')
-
doInTransaction
(func, *args, **kw)[source]¶ This routine can be used to run a function in a transaction, rolling the transaction back if any exception is raised from that function, and committing otherwise.
Use like:
sqlhub.doInTransaction(process_request, os.environ)
This will run
process_request(os.environ)
. The return value will be preserved.
-
threadConnection
¶
-
-
class
sqlobject.dbconnection.
DBAPI
(**kw)[source]¶ Bases:
sqlobject.dbconnection.DBConnection
Subclass must define a makeConnection() method, which returns a newly-created connection object.
queryInsertID
must also be defined.-
accumulateSelect
(select, *expressions)[source]¶ Apply an accumulate function(s) (SUM, COUNT, MIN, AVG, MAX, etc…) to the select object.
-
dbName
= None¶
-
-
class
sqlobject.dbconnection.
DBConnection
(name=None, debug=False, debugOutput=False, cache=True, style=None, autoCommit=True, debugThreading=False, registry=None, logger=None, loglevel=None)[source]¶
-
class
sqlobject.dbconnection.
Iteration
(dbconn, rawconn, select, keepConnection=False)[source]¶ Bases:
object