Skip to content
Snippets Groups Projects
Verified Commit f2a3d8aa authored by Mark's avatar Mark
Browse files

Refactor database session objects

parent bedf01bb
No related branches found
No related tags found
No related merge requests found
......@@ -9,17 +9,14 @@ db_password = environ["DATABASE_PASSWORD"]
db_host = environ["DATABASE_HOST"]
db_name = environ["DATABASE_NAME"]
Session = sessionmaker()
Base = declarative_base()
engine = create_engine('postgresql://{0}:{1}@{2}/{3}'.format(
db_user, db_password, db_host, db_name))
Session.configure(bind=engine, autocommit=True)
db_session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()
def get_user_datastore():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment