init
This commit is contained in:
14
app/connection.py
Normal file
14
app/connection.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from sqlmodel import SQLModel, Session, create_engine
|
||||
|
||||
from app.config import settings
|
||||
|
||||
engine = create_engine(settings.database_url, echo=True)
|
||||
|
||||
|
||||
def init_db():
|
||||
SQLModel.metadata.create_all(engine)
|
||||
|
||||
|
||||
def get_session():
|
||||
with Session(engine) as session:
|
||||
yield session
|
||||
Reference in New Issue
Block a user