Package turbogears :: Module database

Module database

source code

Convenient access to an SQLObject or SQLAlchemy managed database.

Classes
  AutoConnectHub
Connects to the database once per thread.
  PackageHub
Transparently proxies to an AutoConnectHub for the URI that is appropriate for this package.
  EndTransactionsFilter
Functions
 
get_engine()
Retrieve the engine based on the current configuration.
source code
 
mapper(*args, **kwargs)
return a mapper() function which associates this ScopedSession with the Mapper.
 
set_db_uri(dburi, package=None)
Sets the database URI to use either globally or for a specific package.
source code
 
commit_all()
Commits the transactions in all registered hubs (for this thread).
source code
 
rollback_all()
Rollback the transactions in all registered hubs (for this thread).
source code
 
end_all()
End the transactions in all registered hubs (for this thread).
source code
 
so_to_dict(sqlobj)
Convert SQLObject to a dictionary based on columns.
source code
 
so_columns(sqlclass, columns=None)
Return a dict with all columns from a SQLObject.
source code
 
so_joins(sqlclass, joins=None)
Return a list with all joins from a SQLObject.
source code
Variables
  session = None
  metadata = MetaData(None)
Function Details

set_db_uri(dburi, package=None)

source code 

Sets the database URI to use either globally or for a specific package. Note that once the database is accessed, calling setDBUri will have no effect.

Parameters:
  • dburi - database URI to use
  • package - package name this applies to, or None to set the default.

so_columns(sqlclass, columns=None)

source code 

Return a dict with all columns from a SQLObject.

This includes the columns from InheritableSO's bases.

so_joins(sqlclass, joins=None)

source code 

Return a list with all joins from a SQLObject.

The list includes the columns from InheritableSO's bases.