ZODB.Architecture.DB.open

Documentation
Obtain a Connection. Each application thread must call this method at least once to obtain a Connection, from which objects may be obtained. Normally, connections are allocated from a fixed-size pool. If all of the pooled connections are in use, then the call blocks until a connection is made available. This is useful for a number of reasons:

- Resources are conserved.

- Reusing the same connection takes advantage of the object caching features. The object pool is used as a stack, to maximize the likelihood of cache hits.

Options are provided to modify this behavior in a number os ways.

The connection pool is a stack, so that, when the entire pool is not needed, the same connections are used as much as possible to take maximum advantage of the object cache.

The version used by the connection can be controlled. See the version argument for details.

It is possible to have the connection closed automatically at the end of a transaction. See the transaction argument for details.
Parameters
TypeNameDefaultDocumentation
PyStringversion''If a version is given, then the connection will use the named version.
TransactiontransactionNoneIf a transaction is provided, then the connection will be automatically closed when the transaction is terminated. This frees the application from the need to manage connections. It is especially handy when extra connections are needed.
BooleantemporaryfalseIf this argument is true, then a new connection will be created and will be deleted when it is closed. The connection is not retrieved from (or allocated in) the connection pool. This is useful when extra connections are needed, typically to move or compare data between versions.
BooleanforcefalseA true value forces the connection pool, if necessary, to return a connection without blocking.
BooleanwaitflagtrueA false value will cause open to return the value None if a connection cannot be obtained without blocking.
Returns
ConnectionA database connection, or None if waitflag is false and all of the pooled connections are in use.