in src/main.py [0:0]
def convert_index(key_schema: dict) -> str | list[tuple]:
if len(key_schema) == 1:
_LOG.info('Only hash key found for the index')
return key_schema[0]['AttributeName']
elif len(key_schema) == 2:
_LOG.info('Both hash and range keys found for the index')
result = [None, None]
for key in key_schema:
if key['KeyType'] == 'HASH':
_i = 0
elif key['KeyType'] == 'RANGE':
_i = 1
else:
raise ValueError(f'Unknown key type: {key["KeyType"]}')
result[_i] = (key['AttributeName'], -1) # descending
return result
else:
raise ValueError(f'Unknown key schema: {key_schema}')