Turn the ORM Base into a real class
This commit is contained in:
parent
cd74b343bc
commit
6633067563
2 changed files with 7 additions and 8 deletions
|
|
@ -449,8 +449,8 @@ disallow_any_generics = true
|
||||||
# Disallow functions with incomplete type annotations
|
# Disallow functions with incomplete type annotations
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
|
||||||
# Allow subclassing `Any` as long as the ORM models' `Base` is untyped
|
# Disallow subclassing classes typed `Any`
|
||||||
disallow_subclassing_any = false
|
disallow_subclassing_any = true
|
||||||
|
|
||||||
# Disallow calling functions without type annotations ...
|
# Disallow calling functions without type annotations ...
|
||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
"""Provide the ORM's declarative base."""
|
"""Provide the ORM's declarative base."""
|
||||||
|
|
||||||
import typing as t
|
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
|
|
||||||
import velofy
|
import velofy
|
||||||
|
|
||||||
|
|
||||||
Base: t.Any = orm.declarative_base(
|
class Base(orm.DeclarativeBase):
|
||||||
metadata=sa.MetaData(
|
"""The declarative base of all ORM models."""
|
||||||
|
|
||||||
|
metadata = sa.MetaData(
|
||||||
schema=velofy.config.CLEAN_SCHEMA,
|
schema=velofy.config.CLEAN_SCHEMA,
|
||||||
naming_convention={
|
naming_convention={
|
||||||
"pk": "pk_%(table_name)s",
|
"pk": "pk_%(table_name)s",
|
||||||
|
|
@ -18,5 +18,4 @@ Base: t.Any = orm.declarative_base(
|
||||||
"ix": "ix_%(table_name)s_on_%(column_0_N_name)s",
|
"ix": "ix_%(table_name)s_on_%(column_0_N_name)s",
|
||||||
"ck": "ck_%(table_name)s_on_%(constraint_name)s",
|
"ck": "ck_%(table_name)s_on_%(constraint_name)s",
|
||||||
},
|
},
|
||||||
),
|
)
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue