stalker.db.setup

stalker.db.setup(database=None, mappers=[], engine_settings=None)[source]

This is a utillty function that helps to connect the system to the given database.

if the database is None then the it setups using the default database in the settings file.

These are the steps:
  1. creates the engine, and stores it in stalker.db.meta.engine
  2. creates the mappers, adds the given mappers to the stalker.conf.defaults.MAPPERS list
  3. creates the session and binds the engine to it, and stores the session in stalker.db.meta.session
Parameters:
  • database – The database address, default is None, and in this case it uses the database defined in stalker.conf.defaults.DATABASE
  • mappers – The additional mappers module. Use this parameter to customize the whole SOM and database mapping to add your own classes to SOM

Previous topic

stalker.db.tables

Next topic

stalker.core.models

This Page