Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a new column to an existing azure table storage

We are using azure table storage and have thousands of tables using the same schema. Now we are looking to add another column to these tables. How do we add another column to our existing tables without deleting the table and re-adding it?

like image 245
Hoang Avatar asked Jan 20 '12 13:01

Hoang


People also ask

How do I add a column to an Azure table storage?

Windows Azure Table Storage doesn't actually have columns. Each entity (e.g. a Row) is simply a set of properties, with no fixed schema. If you're using a strongly-typed class to write to your table, then you just need to add your new property to that class.

How do you update Azure table storage?

To update an entity, we use the Replace table operation. The first step is to retrieve the entity from the table and change the values to the required properties and perform the Replace operation. //Retrieve the storage account from the connection string.


1 Answers

Windows Azure Table Storage doesn't actually have columns. Each entity (e.g. a Row) is simply a set of properties, with no fixed schema. If you're using a strongly-typed class to write to your table, then you just need to add your new property to that class.

For older rows that don't have the new property, the value in your class object will be set to its default value.

like image 126
David Makogon Avatar answered Sep 28 '22 07:09

David Makogon