Add basic database setup

This commit is contained in:
Tim Van Baak 2021-04-30 14:25:22 -07:00
parent 0487b85733
commit 2085aae0d4
1 changed files with 13 additions and 0 deletions

13
amanuensis/database.py Normal file
View File

@ -0,0 +1,13 @@
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///:memory:')
# Thread-safe db session
session = scoped_session(sessionmaker(bind=engine))
# Base class for ORM models
ModelBase = declarative_base(engine)