From 2085aae0d4dd65d4236963ab6f4d0e6a64a29945 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Fri, 30 Apr 2021 14:25:22 -0700 Subject: [PATCH] Add basic database setup --- amanuensis/database.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 amanuensis/database.py diff --git a/amanuensis/database.py b/amanuensis/database.py new file mode 100644 index 0000000..af00d45 --- /dev/null +++ b/amanuensis/database.py @@ -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)