Skip to content

Commit f694698

Browse files
author
Michael Christensen
committed
Correct logic for provisioned schema table attributes
1 parent b6a721c commit f694698

File tree

1 file changed

+7
-6
lines changed
  • src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server

1 file changed

+7
-6
lines changed

src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server/client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,13 @@ async def describe_table(self, keyspace_name: str, table_name: str) -> Dict[str,
328328
table_details['capacity_mode'] = props['capacity_mode']
329329

330330
if props['capacity_mode'] == 'PROVISIONED':
331-
table_details['read_capacity_units'] = int(
332-
props.get('read_capacity_units', 0)
333-
)
334-
table_details['write_capacity_units'] = int(
335-
props.get('write_capacity_units', 0)
336-
)
331+
if 'read_capacity_units' not in props or 'write_capacity_units' not in props:
332+
raise RuntimeError(
333+
f'PROVISIONED capacity mode requires both read_capacity_units '
334+
f'and write_capacity_units for table {keyspace_name}.{table_name}'
335+
)
336+
table_details['read_capacity_units'] = int(props['read_capacity_units'])
337+
table_details['write_capacity_units'] = int(props['write_capacity_units'])
337338
except (RuntimeError, ValueError, AttributeError) as e:
338339
# Ignore errors when trying to get capacity information
339340
logger.warning(

0 commit comments

Comments
 (0)