Package trunk :: Package src :: Module model
[hide private]
[frames] | no frames]

Module model

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.

Classes [hide private]
  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».
Functions [hide private]
 
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, **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
Variables [hide private]
  path = '/home/tallada/Projectes/PIC/multivac/trunk/lib/sqlalch...
  metadata = MetaData(bind=None)
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
  __package__ = 'trunk.src'

Imports: os, sys, sqlalchemy, Column, MetaData, Table, Index, ForeignKeyConstraint, PrimaryKeyConstraint, UniqueConstraint, Boolean, Integer, String, Text, engine_from_config, func, event, association_proxy, hybrid_property, mapper, relationship, scoped_session, sessionmaker, attribute_mapped_collection, NoResultFound, Session, literal, json


Function Details [hide private]

init(session_maker, **kwargs)

source code 

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

setup_mappers(**kwargs)

source code 

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

Variables Details [hide private]

path

Value:
'/home/tallada/Projectes/PIC/multivac/trunk/lib/sqlalchemy.zip'