fullfill graphql usertype; change db session to dep injection
This commit is contained in:
@@ -21,6 +21,19 @@ if not DATABASE_URL:
|
||||
engine = create_engine(
|
||||
DATABASE_URL,
|
||||
pool_recycle=3600,
|
||||
pool_pre_ping=True
|
||||
pool_pre_ping=True,
|
||||
connect_args={
|
||||
"keepalives": 1,
|
||||
"keepalives_idle": 30,
|
||||
"keepalives_interval": 10,
|
||||
"keepalives_count": 5
|
||||
}
|
||||
)
|
||||
SessionLocal = sessionmaker(bind=engine)
|
||||
SessionLocal = sessionmaker(bind=engine)
|
||||
|
||||
def get_db():
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user