1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
from __future__ import annotations
from typing import Any
from sqlalchemy.orm import DeclarativeBase
from litestar.plugins.sqlalchemy import base, mixins
class _Base(base.CommonTableAttributes, mixins.UUIDPrimaryKey, DeclarativeBase):
"""Fake base SQLAlchemy model for typing purposes."""
Base: _Base
def __getattr__(name: str) -> Any:
if name == "Base":
return type(
"Base",
(base.CommonTableAttributes, mixins.UUIDPrimaryKey, DeclarativeBase),
{"registry": base.create_registry()},
)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|