2222from fastapi_users .models import ID , OAP , UP
2323
2424from . import config
25- from ._generics import UUID_ID
25+ from ._generics import UUID_ID , classproperty
2626from .attributes import GUID , TransformingUnicodeAttribute
2727from .config import __version__ # noqa: F401
2828from .tables import ensure_tables_exist
3131class DynamoDBBaseUserTable (Model , Generic [ID ]):
3232 """Base user table schema for DynamoDB."""
3333
34- __tablename__ : str = config .get ("DATABASE_USERTABLE_NAME" )
34+ @classproperty
35+ def __tablename__ (self ) -> str :
36+ return config .get ("DATABASE_USERTABLE_NAME" )
3537
3638 class Meta :
3739 """The required `Meta` definitions for PynamoDB.
@@ -43,9 +45,17 @@ class Meta:
4345 Currently only supports `PAY_PER_REQUEST`.
4446 """
4547
46- table_name : str = config .get ("DATABASE_USERTABLE_NAME" )
47- region : str = config .get ("DATABASE_REGION" )
48- billing_mode : str = config .get ("DATABASE_BILLING_MODE" ).value
48+ @classproperty
49+ def table_name (self ) -> str :
50+ return config .get ("DATABASE_USERTABLE_NAME" )
51+
52+ @classproperty
53+ def region (self ) -> str :
54+ return config .get ("DATABASE_REGION" )
55+
56+ @classproperty
57+ def billing_mode (self ) -> str :
58+ return config .get ("DATABASE_BILLING_MODE" ).value
4959
5060 class EmailIndex (GlobalSecondaryIndex ):
5161 """Enable the `email` attribute to be a Global Secondary Index.
@@ -96,7 +106,9 @@ class DynamoDBBaseUserTableUUID(DynamoDBBaseUserTable[UUID_ID]):
96106class DynamoDBBaseOAuthAccountTable (Model , Generic [ID ]):
97107 """Base OAuth account table schema for DynamoDB."""
98108
99- __tablename__ : str = config .get ("DATABASE_OAUTHTABLE_NAME" )
109+ @classproperty
110+ def __tablename__ (self ) -> str :
111+ return config .get ("DATABASE_OAUTHTABLE_NAME" )
100112
101113 class Meta :
102114 """The required `Meta` definitions for PynamoDB.
@@ -108,9 +120,17 @@ class Meta:
108120 Currently only supports `PAY_PER_REQUEST`.
109121 """
110122
111- table_name : str = config .get ("DATABASE_OAUTHTABLE_NAME" )
112- region : str = config .get ("DATABASE_REGION" )
113- billing_mode : str = config .get ("DATABASE_BILLING_MODE" ).value
123+ @classproperty
124+ def table_name (self ) -> str :
125+ return config .get ("DATABASE_OAUTHTABLE_NAME" )
126+
127+ @classproperty
128+ def region (self ) -> str :
129+ return config .get ("DATABASE_REGION" )
130+
131+ @classproperty
132+ def billing_mode (self ) -> str :
133+ return config .get ("DATABASE_BILLING_MODE" ).value
114134
115135 class AccountIdIndex (GlobalSecondaryIndex ):
116136 """Enable the `account_id` attribute to be a Global Secondary Index.
0 commit comments