Scalable NoSQL data storage for unstructured data
Azure Table Storage is a NoSQL key-attribute data store that accepts unstructured, semi-structured, and structured data. It's ideal for applications that need a flexible schema and massive scale. Unlike SQL databases, Table Storage doesn't enforce relationships between entities, making it highly adaptable.
You can create a table using the Azure portal, Azure CLI, PowerShell, or programmatically using Azure Storage SDKs.
Entities are inserted into a table. Each entity requires a PartitionKey and a RowKey.
// Example using Azure Storage SDK for .NET
CloudTable table = tableClient.GetTableReference("MyTableName");
await table.CreateIfNotExistsAsync();
// Create an entity
DynamicTableEntity customer = new DynamicTableEntity("Sales", "987");
customer.Properties.Add("Name", new EntityProperty("Walter Gordon"));
customer.Properties.Add("Email", new EntityProperty(" walter@contoso.com"));
customer.Properties.Add("PhoneNumber", new EntityProperty("425-555-1212"));
// Insert the entity
TableOperation insertOperation = TableOperation.Insert(customer);
await table.ExecuteAsync(insertOperation);
You can query entities using various filters based on partition, row, and property values.
# Example using Azure Storage SDK for Python
from azure.cosmosdb.table.tableservice import TableService
from azure.cosmosdb.table.models import EntityProperty
table_service = TableService(account_name='your_storage_account_name', account_key='your_storage_account_key')
# Query for entities in a specific partition
entities = table_service.query_entities('MyTableName', "PartitionKey eq 'Sales'")
for entity in entities:
print(f"Name: {entity.Name}, Email: {entity.Email}")
Entities can be updated or deleted based on their PartitionKey and RowKey.
Deletes an existing entity. Fails if the entity doesn't exist.
Table Storage is designed for massive scale. Understanding how PartitionKey affects data distribution is key to achieving optimal performance.
PartitionKey are stored together. Queries targeting a specific PartitionKey are very efficient.RowKey. This allows for efficient range queries within a partition.PartitionKey for all entities) become a bottleneck due to excessive traffic.The choice of PartitionKey significantly impacts performance and scalability. Design your PartitionKey strategy carefully:
PartitionKey values for different types of data or users to spread operations across multiple partitions.PartitionKey if you frequently query that data together.Azure Table Storage pricing is based on data storage, number of transactions, and data egress.
For detailed pricing information, please refer to the Azure Table Storage pricing page.