- Package Name: azure-data-tables
- Package Version: 12.2.0
- Operating System: any
- Python Version: 3.10.1
Describe the bug
SDK behavior should consider the difference while facing both Cosmos DB Table API, and Storage Account Table Service, and this issue is reporting for their naming rule difference then leads exception.
When SDK (azure-data-tables) deal with a table named "a-test-table" in Cosmos DB -Table API, it will receive exception below.
ValueError: Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.
This is caused by the naming rule checking in here: /sdk/tables/azure-data-tables/azure/data/tables/_error.py
But the checking rule is only feasible for Storage Account - Table services, not Cosmos DB Table API, please reference the naming rule below.
To Reproduce
CosmosDBConnectionString = "DefaultEndpointsProtocol=https;AccountName=account;AccountKey=key;TableEndpoint=https://account.table.cosmos.azure.com:443/;" CosmosDBTableServiceClient = TableServiceClient.from_connection_string(conn_str = CosmosDBConnectionString) CosmosDBTableClient = CosmosDBTableServiceClient.get_table_client(table_name = "a-test-table")
Expected behavior
Suggestion 1. remove table name checking, fall back to backend service and return error message accordingly.
Suggestion 2. check which the connected service is, then applying different naming rule checking accordingly.
Screenshots


Additional context
Cosmos DB - Resource name rules
No specified for container/table level rule in doc.
But in other doc, explain the limitation of container/table name should be:
names must contain from 1 through 255 characters, and they cannot contain /, \, #, ?, or a trailing space
Storage Account -Resource name rules
table / 3-63 / Alphanumerics + Start with letter
note:
In the deprecated SDK azure-cosmosdb-table 1.0.6, it’s just simply checked the input shouldn't be empty only.
Describe the bug
SDK behavior should consider the difference while facing both Cosmos DB Table API, and Storage Account Table Service, and this issue is reporting for their naming rule difference then leads exception.
When SDK (azure-data-tables) deal with a table named "a-test-table" in Cosmos DB -Table API, it will receive exception below.
This is caused by the naming rule checking in here: /sdk/tables/azure-data-tables/azure/data/tables/_error.py
But the checking rule is only feasible for Storage Account - Table services, not Cosmos DB Table API, please reference the naming rule below.
To Reproduce
CosmosDBConnectionString = "DefaultEndpointsProtocol=https;AccountName=account;AccountKey=key;TableEndpoint=https://account.table.cosmos.azure.com:443/;" CosmosDBTableServiceClient = TableServiceClient.from_connection_string(conn_str = CosmosDBConnectionString) CosmosDBTableClient = CosmosDBTableServiceClient.get_table_client(table_name = "a-test-table")Expected behavior
Suggestion 1. remove table name checking, fall back to backend service and return error message accordingly.
Suggestion 2. check which the connected service is, then applying different naming rule checking accordingly.
Screenshots


Additional context
Cosmos DB - Resource name rules
No specified for container/table level rule in doc.
But in other doc, explain the limitation of container/table name should be:
names must contain from 1 through 255 characters, and they cannot contain /, \, #, ?, or a trailing space
Storage Account -Resource name rules
table / 3-63 / Alphanumerics + Start with letter
note:
In the deprecated SDK azure-cosmosdb-table 1.0.6, it’s just simply checked the input shouldn't be empty only.