
- Set up project structure with FastAPI - Configure SQLite database with SQLAlchemy - Set up Alembic for migrations - Create Item model and schema - Implement CRUD operations - Add health endpoint generated with BackendIM... (backend.im)
13 lines
307 B
Python
13 lines
307 B
Python
from typing import Any
|
|
from sqlalchemy.ext.declarative import as_declarative, declared_attr
|
|
|
|
|
|
@as_declarative()
|
|
class Base:
|
|
id: Any
|
|
__name__: str
|
|
|
|
# Generate tablename automatically based on class name
|
|
@declared_attr
|
|
def __tablename__(cls) -> str:
|
|
return cls.__name__.lower() |