0
|
1 """The application's model objects"""
|
|
2 import logging
|
|
3 import sqlalchemy as sa
|
|
4 from sqlalchemy import orm
|
|
5 from pylons_app.model import meta
|
|
6 from pylons_app.model.meta import Session
|
|
7 log = logging.getLogger(__name__)
|
|
8
|
|
9 # Add these two imports:
|
|
10 import datetime
|
|
11 from sqlalchemy import schema, types
|
|
12
|
|
13 def init_model(engine):
|
|
14 """Call me before using any of the tables or classes in the model"""
|
|
15 log.info("INITIALIZING DB MODELS")
|
|
16 meta.Base.metadata.bind = engine
|
|
17 #meta.Base2.metadata.bind = engine2
|
|
18
|
|
19 #THIS IS A TEST FOR EXECUTING SCRIPT AND LOAD PYLONS APPLICATION GLOBALS
|
|
20 #from paste.deploy import appconfig
|
|
21 #from pylons import config
|
|
22 #from sqlalchemy import engine_from_config
|
|
23 #from pylons_app.config.environment import load_environment
|
|
24 #
|
|
25 #conf = appconfig('config:development.ini', relative_to = './../../')
|
|
26 #load_environment(conf.global_conf, conf.local_conf)
|
|
27 #
|
|
28 #engine = engine_from_config(config, 'sqlalchemy.')
|
|
29 #init_model(engine)
|
|
30 # DO SOMETHING
|