Package multivac
source code
MultiVAC generic framework for building tree-based status
applications.
This modules provides an implementation of a generic framework, called
MultiVAC, for use in building applications working with trees of
elements, in which the status of a node derives from the status of the
leaves.
Two classes are defined, one for each table in the relational model Element, Project. Also, two
additional classes are defined for the association relationships between
the former: TagElement and TagProject.
|
CTENotSupported
User-defined exception to warn the user when calling a method that
uses Common Table Expressions (CTE) to perform its work.
|
|
ORM_Base
Base class for mapping the tables.
|
|
Element
Mapping class for the table «element».
|
|
Project
Mapping class for the table «project».
|
|
TagElement
Mapping class for the table «tagelement».
|
|
TagProject
Mapping class for the table «tagproject».
|
|
init(session_maker,
**kwargs)
Initialize the db connection, set up the tables and map the classes. |
source code
|
|
|
setup_tables()
Define the tables, columns, keys and constraints of the DB. |
source code
|
|
|
setup_mappers(**kwargs)
Define the mapping between tables and classes, and the relationships
that link them. |
source code
|
|
|
setup_events(session_maker,
**kwargs)
Define the events of the model. |
source code
|
|
|
_session_before_flush(session,
flush_context,
instances)
Ensure that when an Element instance is deleted, the children
collection of its parent is notified to update and cascade the status
change. |
source code
|
|
|
metadata = MetaData()
Metadata object for this model
|
|
tables = {}
Name-indexed dict containing the definition of every table
|
|
mappers = {}
Name-indexed dict containing the mapper of every table
|
Imports:
os,
sys,
warnings,
sqlalchemy,
Column,
MetaData,
Table,
Index,
ForeignKeyConstraint,
PrimaryKeyConstraint,
UniqueConstraint,
Boolean,
Integer,
String,
Text,
create_engine,
func,
event,
association_proxy,
hybrid_property,
mapper,
relationship,
scoped_session,
sessionmaker,
attribute_mapped_collection,
NoResultFound,
object_session,
identity_key,
literal,
literal_column
Initialize the db connection, set up the tables and map the
classes.
- Parameters:
session_maker (sqlalchemy.orm.session.Session factory) - Session generator to bind to the model
kwargs (dict) - Additional settings for the mapper
|
Define the mapping between tables and classes, and the relationships
that link them.
- Parameters:
extra_mapping (dict) - Mapping between database tables and classes
extra_properties (dict) - Dictionary of additional properties for a table
extra_extensions (dict) - Dictionary of additional extensions for a table
extra_kwargs (dict) - Dictionary of additional arguments for a mapper
|