Created
February 18, 2021 04:33
-
-
Save orcaman/495b9e9d5c54a97bceddcdb05d3f3e62 to your computer and use it in GitHub Desktop.
get_composite_keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_composite_keys(table_name: str) -> list: | |
if table_name in table_composite_keys: | |
return table_composite_keys[table_name] | |
composite_keys = list() | |
desc = dynamodb_client.describe_table(TableName=table_name) | |
key_schema = desc['Table']['KeySchema'] | |
for k in key_schema: | |
if '#' in k['AttributeName']: | |
composite_keys.append(k['AttributeName']) | |
table_composite_keys[table_name] = composite_keys | |
return composite_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment