af26ba2d61d5b2ee5e421b242c89a0d124b7069f
1 """The application's model objects"""
2 import sqlalchemy
as sa
3 from sqlalchemy
import orm
5 from floof
.model
import meta
7 def init_model(engine
):
8 """Call me before using any of the tables or classes in the model"""
9 ## Reflected tables must be defined and mapped here
10 #global reflected_table
11 #reflected_table = sa.Table("Reflected", meta.metadata, autoload=True,
12 # autoload_with=engine)
13 #orm.mapper(Reflected, reflected_table)
15 meta
.Session
.configure(bind
=engine
)
19 ## Non-reflected tables may be defined and mapped at module level
20 #foo_table = sa.Table("Foo", meta.metadata,
21 # sa.Column("id", sa.types.Integer, primary_key=True),
22 # sa.Column("bar", sa.types.String(255), nullable=False),
28 #orm.mapper(Foo, foo_table)
31 ## Classes for reflected tables may be defined here, but the table and
32 ## mapping itself must be done in the init_model function
33 #reflected_table = None
35 #class Reflected(object):