Azure Table Storage

Scalable NoSQL data storage for unstructured data

Introduction to Azure Table Storage

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.

Key Concepts

Working with Azure Table Storage

Creating a Table

You can create a table using the Azure portal, Azure CLI, PowerShell, or programmatically using Azure Storage SDKs.

Note: Table names must conform to specific naming rules:

Inserting Entities

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);

Querying Entities

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}")

Updating and Deleting Entities

Entities can be updated or deleted based on their PartitionKey and RowKey.

Update Operations:

Delete Operation:

Deletes an existing entity. Fails if the entity doesn't exist.

Performance and Scalability

Table Storage is designed for massive scale. Understanding how PartitionKey affects data distribution is key to achieving optimal performance.

Use Cases

Choosing PartitionKeys

The choice of PartitionKey significantly impacts performance and scalability. Design your PartitionKey strategy carefully:

Pricing

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.

Next Steps