2323from typing_extensions import Self , TypeVar
2424
2525from advanced_alchemy .mixins import (
26- AuditColumns as _AuditColumns ,
27- )
28- from advanced_alchemy .mixins import (
29- BigIntPrimaryKey as _BigIntPrimaryKey ,
30- )
31- from advanced_alchemy .mixins import (
32- NanoIDPrimaryKey as _NanoIDPrimaryKey ,
33- )
34- from advanced_alchemy .mixins import (
35- UUIDPrimaryKey as _UUIDPrimaryKey ,
36- )
37- from advanced_alchemy .mixins import (
38- UUIDv6PrimaryKey as _UUIDv6PrimaryKey ,
39- )
40- from advanced_alchemy .mixins import (
41- UUIDv7PrimaryKey as _UUIDv7PrimaryKey ,
26+ AuditColumns ,
27+ BigIntPrimaryKey ,
28+ NanoIDPrimaryKey ,
29+ UUIDPrimaryKey ,
30+ UUIDv6PrimaryKey ,
31+ UUIDv7PrimaryKey ,
4232)
4333from advanced_alchemy .types import GUID , DateTimeUTC , JsonB
4434from advanced_alchemy .utils .dataclass import DataclassProtocol
45- from advanced_alchemy .utils .deprecation import warn_deprecation
4635
4736if TYPE_CHECKING :
48- # these should stay here since they are deprecated. They are imported in the __getattr__ function
4937 from sqlalchemy .sql import FromClause
5038 from sqlalchemy .sql .schema import (
5139 _NamingSchemaParameter as NamingSchemaParameter , # pyright: ignore[reportPrivateUsage]
5240 )
5341
54- from advanced_alchemy .mixins import (
55- AuditColumns ,
56- BigIntPrimaryKey ,
57- NanoIDPrimaryKey ,
58- SlugKey ,
59- UUIDPrimaryKey ,
60- UUIDv6PrimaryKey ,
61- UUIDv7PrimaryKey ,
62- )
63-
6442
6543__all__ = (
6644 "AdvancedDeclarativeBase" ,
67- "AuditColumns" ,
6845 "BasicAttributes" ,
6946 "BigIntAuditBase" ,
7047 "BigIntBase" ,
7148 "BigIntBaseT" ,
72- "BigIntPrimaryKey" ,
7349 "CommonTableAttributes" ,
7450 "ModelProtocol" ,
7551 "NanoIDAuditBase" ,
7652 "NanoIDBase" ,
7753 "NanoIDBaseT" ,
78- "NanoIDPrimaryKey" ,
7954 "SQLQuery" ,
80- "SlugKey" ,
8155 "TableArgsType" ,
8256 "UUIDAuditBase" ,
8357 "UUIDBase" ,
8458 "UUIDBaseT" ,
85- "UUIDPrimaryKey" ,
8659 "UUIDv6AuditBase" ,
8760 "UUIDv6Base" ,
8861 "UUIDv6BaseT" ,
89- "UUIDv6PrimaryKey" ,
9062 "UUIDv7AuditBase" ,
9163 "UUIDv7Base" ,
9264 "UUIDv7BaseT" ,
93- "UUIDv7PrimaryKey" ,
9465 "convention" ,
9566 "create_registry" ,
9667 "merge_table_arguments" ,
10071)
10172
10273
103- def __getattr__ (attr_name : str ) -> object :
104- if attr_name == "__path__" :
105- return __file__
106-
107- _deprecated_attrs = {
108- "SlugKey" ,
109- "AuditColumns" ,
110- "NanoIDPrimaryKey" ,
111- "BigIntPrimaryKey" ,
112- "UUIDPrimaryKey" ,
113- "UUIDv6PrimaryKey" ,
114- "UUIDv7PrimaryKey" ,
115- }
116- if attr_name in _deprecated_attrs :
117- from advanced_alchemy import mixins
118-
119- module = "advanced_alchemy.mixins"
120- value = globals ()[attr_name ] = getattr (mixins , attr_name )
121-
122- warn_deprecation (
123- deprecated_name = f"advanced_alchemy.base.{ attr_name } " ,
124- version = "0.26.0" ,
125- kind = "import" ,
126- removal_in = "1.0.0" ,
127- info = f"importing { attr_name } from 'advanced_alchemy.base' is deprecated, please import it from '{ module } ' instead" ,
128- )
129-
130- return value
131- if attr_name in set (__all__ ).difference (_deprecated_attrs ):
132- value = globals ()[attr_name ] = locals ()[attr_name ]
133- return value
134-
135- msg = f"module { __name__ !r} has no attribute { attr_name !r} "
136- raise AttributeError (msg )
137-
138-
13974UUIDBaseT = TypeVar ("UUIDBaseT" , bound = "UUIDBase" )
14075"""Type variable for :class:`UUIDBase`."""
14176BigIntBaseT = TypeVar ("BigIntBaseT" , bound = "BigIntBase" )
@@ -385,7 +320,7 @@ def __init_subclass__(cls, **kwargs: Any) -> None:
385320 super ().__init_subclass__ (** kwargs )
386321
387322
388- class UUIDBase (_UUIDPrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
323+ class UUIDBase (UUIDPrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
389324 """Base for all SQLAlchemy declarative models with UUID v4 primary keys.
390325
391326 .. seealso::
@@ -398,7 +333,7 @@ class UUIDBase(_UUIDPrimaryKey, CommonTableAttributes, AdvancedDeclarativeBase,
398333 __abstract__ = True
399334
400335
401- class UUIDAuditBase (CommonTableAttributes , _UUIDPrimaryKey , _AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
336+ class UUIDAuditBase (CommonTableAttributes , UUIDPrimaryKey , AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
402337 """Base for declarative models with UUID v4 primary keys and audit columns.
403338
404339 .. seealso::
@@ -412,7 +347,7 @@ class UUIDAuditBase(CommonTableAttributes, _UUIDPrimaryKey, _AuditColumns, Advan
412347 __abstract__ = True
413348
414349
415- class UUIDv6Base (_UUIDv6PrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
350+ class UUIDv6Base (UUIDv6PrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
416351 """Base for all SQLAlchemy declarative models with UUID v6 primary keys.
417352
418353 .. seealso::
@@ -425,7 +360,7 @@ class UUIDv6Base(_UUIDv6PrimaryKey, CommonTableAttributes, AdvancedDeclarativeBa
425360 __abstract__ = True
426361
427362
428- class UUIDv6AuditBase (CommonTableAttributes , _UUIDv6PrimaryKey , _AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
363+ class UUIDv6AuditBase (CommonTableAttributes , UUIDv6PrimaryKey , AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
429364 """Base for declarative models with UUID v6 primary keys and audit columns.
430365
431366 .. seealso::
@@ -439,7 +374,7 @@ class UUIDv6AuditBase(CommonTableAttributes, _UUIDv6PrimaryKey, _AuditColumns, A
439374 __abstract__ = True
440375
441376
442- class UUIDv7Base (_UUIDv7PrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
377+ class UUIDv7Base (UUIDv7PrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
443378 """Base for all SQLAlchemy declarative models with UUID v7 primary keys.
444379
445380 .. seealso::
@@ -452,7 +387,7 @@ class UUIDv7Base(_UUIDv7PrimaryKey, CommonTableAttributes, AdvancedDeclarativeBa
452387 __abstract__ = True
453388
454389
455- class UUIDv7AuditBase (CommonTableAttributes , _UUIDv7PrimaryKey , _AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
390+ class UUIDv7AuditBase (CommonTableAttributes , UUIDv7PrimaryKey , AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
456391 """Base for declarative models with UUID v7 primary keys and audit columns.
457392
458393 .. seealso::
@@ -466,7 +401,7 @@ class UUIDv7AuditBase(CommonTableAttributes, _UUIDv7PrimaryKey, _AuditColumns, A
466401 __abstract__ = True
467402
468403
469- class NanoIDBase (_NanoIDPrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
404+ class NanoIDBase (NanoIDPrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
470405 """Base for all SQLAlchemy declarative models with Nano ID primary keys.
471406
472407 .. seealso::
@@ -479,7 +414,7 @@ class NanoIDBase(_NanoIDPrimaryKey, CommonTableAttributes, AdvancedDeclarativeBa
479414 __abstract__ = True
480415
481416
482- class NanoIDAuditBase (CommonTableAttributes , _NanoIDPrimaryKey , _AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
417+ class NanoIDAuditBase (CommonTableAttributes , NanoIDPrimaryKey , AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
483418 """Base for declarative models with Nano ID primary keys and audit columns.
484419
485420 .. seealso::
@@ -493,7 +428,7 @@ class NanoIDAuditBase(CommonTableAttributes, _NanoIDPrimaryKey, _AuditColumns, A
493428 __abstract__ = True
494429
495430
496- class BigIntBase (_BigIntPrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
431+ class BigIntBase (BigIntPrimaryKey , CommonTableAttributes , AdvancedDeclarativeBase , AsyncAttrs ):
497432 """Base for all SQLAlchemy declarative models with BigInt primary keys.
498433
499434 .. seealso::
@@ -506,7 +441,7 @@ class BigIntBase(_BigIntPrimaryKey, CommonTableAttributes, AdvancedDeclarativeBa
506441 __abstract__ = True
507442
508443
509- class BigIntAuditBase (CommonTableAttributes , _BigIntPrimaryKey , _AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
444+ class BigIntAuditBase (CommonTableAttributes , BigIntPrimaryKey , AuditColumns , AdvancedDeclarativeBase , AsyncAttrs ):
510445 """Base for declarative models with BigInt primary keys and audit columns.
511446
512447 .. seealso::
0 commit comments