Some checks failed
Run linters on applied template / Python 3.13 lint and build (push) Failing after 41s
This is a FastAPI backend microservice template used with `copier` utility. Features of applied template are: - Configuration file processing logic - Metrics and tracing (both optional) configuration available - Debug endpoints - Database migration commands, prepared Alembic environment - Database usage example in ping_db endpoint - gitea sanity check pipeline
22 lines
691 B
Python
22 lines
691 B
Python
"""SQL naming convention for Alembic is defined here."""
|
|
|
|
from sqlalchemy import MetaData
|
|
from sqlalchemy.orm import declarative_base
|
|
|
|
convention = {
|
|
"all_column_names": lambda constraint, _: "_".join([str(column.name) for column in constraint.columns.values()]),
|
|
"ix": "ix_%(table_name)s_%(all_column_names)s",
|
|
"uq": "%(table_name)s_%(all_column_names)s_key",
|
|
"ck": "ck_%(table_name)s_%(column_0_name)s",
|
|
"fk": "%(table_name)s_fk_%(all_column_names)s__%(referred_table_name)s",
|
|
"pk": "%(table_name)s_pk",
|
|
}
|
|
|
|
metadata = MetaData(naming_convention=convention)
|
|
DeclarativeBase = declarative_base(metadata=metadata)
|
|
|
|
__all__ = [
|
|
"DeclarativeBase",
|
|
"metadata",
|
|
]
|