
- Create Todo model and schemas - Set up API endpoints for CRUD operations - Configure SQLAlchemy for database access - Set up Alembic for database migrations - Add Ruff for code linting - Update README with project documentation
23 lines
465 B
Python
23 lines
465 B
Python
"""
|
|
Base class for SQLAlchemy models.
|
|
"""
|
|
from typing import Any
|
|
|
|
from sqlalchemy.ext.declarative import as_declarative, declared_attr
|
|
|
|
|
|
@as_declarative()
|
|
class Base:
|
|
"""
|
|
Base class for all SQLAlchemy models.
|
|
"""
|
|
id: Any
|
|
__name__: str
|
|
|
|
# Generate __tablename__ automatically
|
|
@declared_attr
|
|
def __tablename__(cls) -> str:
|
|
"""
|
|
Generate table name based on the class name.
|
|
"""
|
|
return cls.__name__.lower() |