在尝试在azure表存储中插入记录时,获取异常“属性值大于表服务允许的值”。
Follwing是我的桌子结构,
string PartitionKey,String RowKey,string Id,string site,string name,byte [] content,
public DateTime createdtime
我试图在内容字段中保存83755字节数组(82KB),其他字段最多包含35个字符。
任何人都可以告诉我azure存储表的最大行数是多少?
以下是我提到的网址..其中提到的行最多可以有1MB。但我的不超过100 KB。
谢谢,
戈皮纳特
答案 0 :(得分:13)
是的,每行最多可以有1MB。但是,每个字节数组属性或字符串属性限制为64K。有关每种数据类型的详细信息,请参阅this MSDN reference。
答案 1 :(得分:5)
我建议查看Lokad.Cloud for Azure框架(开源)。有一个经过生产测试的代码,用于将大型实体序列化到表存储中 960KB限制(属性拆分和管理由框架处理)
的示例用法// TODO: change your connection string here
var providers = Standalone.CreateProviders(
"DefaultEndpointsProtocol=https;AccountName=;AccountKey=");
// 'books' is the name of the table
var books = new CloudTable<Book>(providers.TableStorage, "books");
var potterBook = new Book
{ Author = "J. K. Rowling", Title = "Harry Potter" };
var poemsBook = new Book
{ Author = "John Keats", Title = "Complete Poems" };
// inserting (or updating record in Table Storage)
books.Upsert(new[]
{
new CloudEntity<Book> {
PartitionKey = "UK", RowRey = "potter", Value = potterBook},
new CloudEntity<Book> {
PartitionKey = "UK", RowRey = "poems", Value = poemsBook}
});
// reading from table
foreach(var entity in books.Get())
{
Console.WriteLine("{0} by {1} in partition '{2}' and rowkey '{3}'",
entity.Value.Title, entity.Value.Author,
entity.PartitionKey, entity.RowRey);
}
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
答案 2 :(得分:2)
2017年5月,Azure推出了Premium Table,它实际上将Azure Cosmos DB(以前称为Azure DocumentDB)与Azure Table API结合使用。
Premium Table对每个实体(行)具有相同的1MB限制,但对于单个属性(没有64K限制),它允许最多1MB。
此外,它允许在专用RU内无限数量的属性(Azure表:255)和属性名称长度(Azure表:255)。请求单位是Cosmos DB的资源消耗单位。