Skip to content

Instantly share code, notes, and snippets.

@orcaman
Created February 18, 2021 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orcaman/495b9e9d5c54a97bceddcdb05d3f3e62 to your computer and use it in GitHub Desktop.
Save orcaman/495b9e9d5c54a97bceddcdb05d3f3e62 to your computer and use it in GitHub Desktop.
get_composite_keys
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