Changeset 10419 for main/waeup.cas
- Timestamp:
- 9 Jul 2013, 07:16:32 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/db.py
r10406 r10419 6 6 from sqlalchemy.ext.declarative import declarative_base 7 7 from sqlalchemy.orm import sessionmaker, scoped_session 8 from sqlalchemy.pool import StaticPool 8 9 9 10 … … 81 82 82 83 def __init__(self, connection_string): 83 self.engine = create_engine(connection_string) 84 args = {} 85 if connection_string in ('sqlite:///', 'sqlite:///:memory:'): 86 # make sure all threads access the same memory 87 args = dict(connect_args={'check_same_thread': False}, 88 poolclass=StaticPool) 89 self.engine = create_engine(connection_string, **args) 84 90 self.metadata = MetaData() 85 91 Base.metadata.create_all(self.engine)
Note: See TracChangeset for help on using the changeset viewer.