Dunitz/db setup (#1619)

* initial database setup
This commit is contained in:
Madison Dunitz
2020-08-03 17:54:06 -05:00
committed by GitHub
parent 8bbc183647
commit f632a8db91
13 changed files with 278 additions and 5 deletions
+18
View File
@@ -0,0 +1,18 @@
"""
Drops and recreates all tables for local testing according to cellxgene_orm.py
"""
from sqlalchemy import create_engine
from server.db.cellxgene_orm import Base
def create_db(database_uri: str = "postgresql://postgres:test_pw@localhost:5432"):
engine = create_engine(database_uri)
print("Dropping tables")
Base.metadata.drop_all(engine)
print("Recreating tables")
Base.metadata.create_all(engine)
if __name__ == "__main__":
create_db()