Created basic backend structure, auth and CRUD endpoints.
This commit is contained in:
22
data/db.py
Normal file
22
data/db.py
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker, declarative_base
|
||||
|
||||
DATABASE_URL = "sqlite+aiosqlite:///files/db.sqlite"
|
||||
|
||||
engine = create_async_engine(DATABASE_URL, echo=False)
|
||||
SessionLocal = sessionmaker(
|
||||
bind=engine,
|
||||
class_=AsyncSession,
|
||||
expire_on_commit=False,
|
||||
)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
logging.basicConfig()
|
||||
logging.getLogger('sqlalchemy').setLevel(logging.WARNING)
|
||||
|
||||
logging.getLogger('sqlalchemy.engine').disabled = True
|
||||
Reference in New Issue
Block a user