"""The application's model objects"""
from sqlalchemy.orm import scoped_session, sessionmaker
import elixir

from {{package}}.model import meta

# make Session available for use and
# store for later access
# Ready for SQLA 0.5 !!
import sqlalchemy
if sqlalchemy.__version__ > '0.5':
    Session = scoped_session(sessionmaker())
else:
    Session = scoped_session(sessionmaker(autoflush=True, transactional=True))

elixir.session = Session
elixir.options_defaults.update({
    'shortnames': True
})

# use the elixir metadata
metadata = elixir.metadata

# this will be called in config/environment.py
def init_model(engine):
    metadata.bind = engine

# The shabti_auth template defines a user model. It is imported here.

from user import *

# The shabti_auth_rdfalchemy template defines a user model. It is imported here.

from rdfmodel import *

# import other entities here, e.g.

# from {{package}}.model.blog import *


# Finally, call elixir to set up the tables.

elixir.setup_all()


