lib.adapter

Module Contents

Classes

DatabaseAdapter(self)
FileAdapter(self,cwd=None)
class DatabaseAdapter
__init__()

This Class provides a bucket for database connection handling. It uses SQLalchemy for database talk. It enables distinct session sharing on the rfc1738 URL string. This reduces the amount of used sessions drastically.

add_connection(connection_string)

Adds a new connection to this object. Also creates the necessary engine and session object.

Args:
connection_string (str): The rfc1738 URL string which defines the database
connection
get_connections()

Returns a dictionary with the available connections.

Returns:
dict: The available connections.
get_session(key, request=None)

The point where you will get what you need: The session to talk to the database!

Args:
key (str): The key to identify the desired connection in the pool of available
connections.
request (pyramid.request.Request or None): The request of the underlying pyramid
application. This can be useful to handle errorcases and treat sessions in the right way.
Returns:
sqlalchemy.orm.Session: The requested clean session instance ready for use
Raises:
KeyError
class FileAdapter(cwd=None)
__init__(cwd=None)
cwd()
cd(path)
ls()
read(filename, mode="rb")