From 1356c9386204f7fff569dad60f58429e0cc4feac Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Sun, 14 Nov 2021 06:53:08 +0700 Subject: [PATCH] none --- driver/database/__init__.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/driver/database/__init__.py b/driver/database/__init__.py index ba4526d..02d36c3 100644 --- a/driver/database/__init__.py +++ b/driver/database/__init__.py @@ -1,29 +1,20 @@ import os - import re from sqlalchemy import create_engine - +from config import DATABASE_URL as db from sqlalchemy.ext.declarative import declarative_base - from sqlalchemy.orm import scoped_session, sessionmaker -from config import DATABASE_URL as db - if db and db.startswith("postgres://"): - app = db.replace("postgres://", "postgresql://", 1) BASE = declarative_base() def start() -> scoped_session: - engine = create_engine(app) - BASE.metadata.bind = engine - BASE.metadata.create_all(engine) - return scoped_session(sessionmaker(bind=engine, autoflush=False)) SESSION = start()