poppy.core.db.connector module

class poppy.core.db.connector.Connector(name, database=None)[source]

Bases: object

Base class for managing sessions with various databases.

add(obj)[source]

Add an object into the session. A simple wrapper around the session.

bind()[source]

To bind the database to the models of the ORM.

database
factory(database)[source]

Given the database, return the session factory.

flush()[source]

Flush the session, i.e. it transfers python objects to the transaction buffer of the database, thus the memory of the session is cleaned up. But if an error occurred, the transaction is rolled back.

get_database()[source]

Return the database object.

classmethod if_connected(*args)[source]

A decorator to execute a function or method only if the database named name is connected.

manager = <poppy.core.generic.manager.Manager object>
rollback()[source]

Undo what has been done in the current transaction.

update_database()[source]

Commit all changes for the current session.