File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ ignore_missing_imports = true
66asyncio_mode = " strict"
77asyncio_default_fixture_loop_scope = " function"
88addopts = " --ignore=test_build.py"
9+ filterwarnings = [
10+ " ignore::DeprecationWarning:.*datetime.datetime.utcnow.*" ,
11+ " ignore::DeprecationWarning:.*botocore.*" ,
12+ ]
913
1014[tool .ruff ]
1115
Original file line number Diff line number Diff line change 55from fastapi_users import schemas
66
77DATABASE_REGION : str = "eu-central-1"
8+ DATABASE_TOKENTABLE_PRIMARY_KEY : str = "token"
9+ DATABASE_USERTABLE_PRIMARY_KEY : str = "id"
810
911
1012class User (schemas .BaseUser ):
Original file line number Diff line number Diff line change 22import botocore .exceptions
33
44
5- async def ensure_table_exists (session : aioboto3 .Session , table_name : str , region : str ):
5+ async def ensure_table_exists (
6+ session : aioboto3 .Session ,
7+ table_name : str ,
8+ primary_key : str ,
9+ region : str ,
10+ ):
611 async with session .client ("dynamodb" , region_name = region ) as client :
712 try :
813 await client .describe_table (TableName = table_name )
914 except botocore .exceptions .ClientError :
1015 await client .create_table (
1116 TableName = table_name ,
1217 KeySchema = [
13- {"AttributeName" : "id" , "KeyType" : "HASH" },
18+ {"AttributeName" : primary_key , "KeyType" : "HASH" },
1419 ],
1520 AttributeDefinitions = [
16- {"AttributeName" : "id" , "AttributeType" : "S" },
21+ {"AttributeName" : primary_key , "AttributeType" : "S" },
1722 ],
1823 ProvisionedThroughput = {"ReadCapacityUnits" : 5 , "WriteCapacityUnits" : 5 },
1924 )
You can’t perform that action at this time.
0 commit comments