Package cubicweb :: Module dbapi
[hide private]
[frames] | no frames]

Module dbapi

source code

DB-API 2.0 compliant module

Take a look at http://www.python.org/peps/pep-0249.html

(most parts of this document are reported here in docstrings)

Classes [hide private]
  ConnectionProperties
  _NeedAuthAccessMock
  DBAPISession
  DBAPIRequest
  ProgrammingError
Exception raised for errors that are related to the database's operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc.
  Cursor
These objects represent a database cursor, which is used to manage the context of a fetch operation. Cursors created from the same connection are not isolated, i.e., any changes done to the database by a cursor are immediately visible by the other cursors. Cursors created from different connections are isolated.
  LogCursor
override the standard cursor to log executed queries
  Connection
DB-API 2.0 compatible Connection object for CubicWeb
Functions [hide private]
 
_fake_property_value(self, name) source code
 
multiple_connections_fix()
some monkey patching necessary when an application has to deal with several connections to different repositories. It tries to hide buggy class attributes since classes are not designed to be shared among multiple registries.
source code
 
multiple_connections_unfix() source code
 
get_repository(method, database=None, config=None, vreg=None)
get a proxy object to the CubicWeb repository, using a specific RPC method.
source code
 
repo_connect(repo, login, **kwargs)
Constructor to create a new connection to the CubicWeb repository.
source code
 
connect(database=None, login=None, host=None, group=None, cnxprops=None, setvreg=True, mulcnx=True, initlog=True, **kwargs)
Constructor for creating a connection to the CubicWeb repository.
source code
 
in_memory_cnx(config, login, **kwargs)
usefull method for testing and scripting to get a dbapi.Connection object connected to an in-memory repository instance
source code
 
check_not_closed(func) source code
Variables [hide private]
  _MARKER = _MARKER
Function Details [hide private]

get_repository(method, database=None, config=None, vreg=None)

source code 

get a proxy object to the CubicWeb repository, using a specific RPC method.

Only 'in-memory' and 'pyro' are supported for now. Either vreg or config argument should be given

repo_connect(repo, login, **kwargs)

source code 

Constructor to create a new connection to the CubicWeb repository.

Returns a Connection instance.

connect(database=None, login=None, host=None, group=None, cnxprops=None, setvreg=True, mulcnx=True, initlog=True, **kwargs)

source code 
Constructor for creating a connection to the CubicWeb repository.
Returns a :class:`Connection` object.

Typical usage::

  cnx = connect('myinstance', login='me', password='toto')

Arguments:

:database:
  the instance's pyro identifier.

:login:
  the user login to use to authenticate.

:host:
  the pyro nameserver host. Will be detected using broadcast query if
  unspecified.

:group:
  the instance's pyro nameserver group. You don't have to specify it unless
  tweaked in instance's configuration.

:cnxprops:
  an optional :class:`ConnectionProperties` instance, allowing to specify
  the connection method (eg in memory or pyro). A Pyro connection will be
  established if you don't specify that argument.

:setvreg:
  flag telling if a registry should be initialized for the connection.
  Don't change this unless you know what you're doing.

:mulcnx:
  Will disappear at some point. Try to deal with connections to differents
  instances in the same process unless specified otherwise by setting this
  flag to False. Don't change this unless you know what you're doing.

:initlog:
  flag telling if logging should be initialized. You usually don't want
  logging initialization when establishing the connection from a process
  where it's already initialized.

:kwargs:
  there goes authentication tokens. You usually have to specify for
  instance a password for the given user, using a named 'password' argument.