- Table storage stores structured NoSQL data, providing a key/value store with a schema-less design.
- Table entries are at 1MB each.
- Access to Table storage data is fast and cost-effective for many types of applications
- It is typically lower in cost comparing to traditional SQL.
- Data in table storage can also be accessed through an OData interface automatically.
- Common uses of Table storage include:
- Storing structured data capable of serving web scale applications.
- Storing datasets that don't require complex joins, foreign keys, or stored procedures and can be denormalized for fast access.
- Quickly querying data using a clustered index.
- Accessing data using the OData protocol and LINQ queries with WCF Data Service .NET Libraries.
- Azure SQL is a much more familiar to developers used to working with various flavors of SQL Server. The trade off is that SQL is much more expensive than tables, and is less scalable.
- Table: A table is a collection of entities.
- Tables don't enforce a schema on entities, which means a single table can contain entities that have different sets of properties.
- Entity: An entity is a set of properties, similar to a database row.
- An entity in Azure Storage can be up to 1MB in size.
- An entity in Azure Cosmos DB can be up to 2MB in size.
- Properties: A property is a name-value pair.
- Each entity can include up to 252 properties to store data.
- Each entity also has three system properties that specify a partition key, a row key, and a timestamp.
- Entities with the same partition key can be queried more quickly, and inserted/updated in atomic operations.
- An entity's row key is its unique identifier within a partition.
Table Service REST API
- NuGet Package:
Microsoft.Azure.Storage.Common
- Cosmos DB Table API provides throughput-optimized tables, global distribution, and automatic secondary indexes.
- Azure Table Storage accounts:
https://<storage account>.table.core.windows.net/<table>
- Azure Cosmos DB Table API accounts:
https://<storage account>.table.cosmosdb.azure.com/<table>
- You can address Azure tables directly using this address with the OData protocol.
<configuration>
<appSettings>
<add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key" />
<!-- Connect to the emulator account using a shortcut -->
<add key="StorageConnectionString" value="UseDevelopmentStorage=true" />
</appSettings>
</configuration>
Add an Entity to a Table
- Entities map to C# objects by using a custom class derived from
TableEntity
.
- An entity's partition and row key together uniquely identify a entity in the table.