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