Azure Cloud Table Storage

10,491

1. No a table isn't the same as a blob or container. A container is used to house blobs, think of them as drives if blobs are the files.

Tables have specific features such as the ability to specify partitions and keys which affects performance.

2. The Azure management interface doesn't provide an interface for working with tables, you can just see metrics in the dashboard and monitor tabs.

For management I recommend you get the Azure Management Studio by Cerebrata, or if you want something free look at the Azure Storage Explorer. Both let you manage tables a bit better.

3. The table structure is generated from your entity you don't need to create or manage columns, you can even vary columns across entities in the same table (though I personally don't like this feature).

Share:
10,491
cheunology
Author by

cheunology

Updated on June 04, 2022

Comments

  • cheunology
    cheunology almost 2 years

    Summary

    • I'm trying to learn how to read and write to Azure Cloud Table Storage.
    • I've read a number of tutorials, and have some questions.
    • In the following simple code example, we access a storage account, get a reference to an existing table, insert a record, and then read the record back from the table, noting that it now exists within the cloud storage table.

    Simple Code Example

    static void Main(string[] args)
    {
      try
      {
         CloudStorageAccount storageAccount =
            CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=<your_storage_name>;AccountKey=<your_account_key>");
         CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
    
         CloudTable table = tableClient.GetTableReference("people");
         table.CreateIfNotExists();
    
         CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
         customer1.Email = "[email protected]";
         customer1.PhoneNumber = "425-555-0101";
    
         // Create the TableOperation that inserts the customer entity.
         var insertOperation = TableOperation.Insert(customer1);
    
         // Execute the insert operation.
         table.Execute(insertOperation);
    
         // Read storage
         TableQuery<CustomerEntity> query =
            new TableQuery<CustomerEntity>()
               .Where(TableQuery.GenerateFilterCondition("PartitionKey",
                   QueryComparisons.Equal, "Harp"));
         var list = table.ExecuteQuery(query).ToList();
       }
       catch (StorageException ex)
       {
           // Exception handling here.
       }
    }
    
    public class CustomerEntity : TableEntity
    {
        public string Email { get; set; }
        public string PhoneNumber { get; set; }
    
        public CustomerEntity(string lastName, string firstName)
        {
            PartitionKey = lastName;
            RowKey = firstName;
        }
    
        public CustomerEntity() { }
    }
    

    Questions

    1. Is a table the same as a blob or a container?
    2. If I wanted to setup my "people" table on my Azure Cloud Storage Account, before actually performing any code operations, do I just create a new storage account, and then create a container or a blob? I can't see any option to create a "table" on the Azure management website?
    3. Once the table exists, do I have to create columns to represent the properties of my entity object that I'm trying to store within the table? Or does the table simply automatically take its structure from the structure of my entity object and its properties?