]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/models.py
Do not use Zope transaction manager.
[xonotic/xonstat.git] / xonstat / models.py
1 import transaction
2
3 from sqlalchemy import Column
4 from sqlalchemy import Integer
5 from sqlalchemy import Unicode
6
7 from sqlalchemy.exc import IntegrityError
8 from sqlalchemy.ext.declarative import declarative_base
9
10 from sqlalchemy.orm import scoped_session
11 from sqlalchemy.orm import sessionmaker
12
13
14 DBSession = scoped_session(sessionmaker())
15 Base = declarative_base()
16
17 def initialize_sql(engine):
18     DBSession.configure(bind=engine)
19     Base.metadata.bind = engine
20     Base.metadata.create_all(engine)