From a74a37157978e56a34fcbe3153885dd67977f8ba Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 9 Mar 2017 12:52:20 +0100 Subject: [PATCH] Started work on the Royal Games database --- database.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 database.py diff --git a/database.py b/database.py new file mode 100644 index 00000000..bc3b28be --- /dev/null +++ b/database.py @@ -0,0 +1,18 @@ +from sqlalchemy import create_engine, Column, Integer, String, Boolean +from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.declarative import declarative_base + +# Initialize the database +engine = create_engine("sqlite:///tempdb.sqlite") +Base = declarative_base() +Session = sessionmaker(bind=engine) + +class Member(Base): + __tablename__ = "members" + + id = Column(Integer, primary_key=True) + username = Column(String, unique=True, nullable=False) + password = Column(String, nullable=False) + royal = Column(Boolean, nullable=False) + +Base.metadata.create_all(engine)