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

徘徊边缘 提交于 2019-12-04 15:25:59

问题


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?


回答1:


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.




回答2:


Great answer from David Makogon above but just wanted to add one additional consideration.

Table Storage does not have a fixed schema as David states but, unfortunately, the dev storage emulator running on localhost does. The reason for this is that the emulator uses SQL server to store localhost data and it needs to create a schema for SQL purposes only. So if you are testing changes such as additional properties in your strongly types class, be prepared for your code changes not working in developer storage.



来源:https://stackoverflow.com/questions/8941958/how-to-add-a-new-column-to-an-existing-azure-table-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!