4
votes

I am trying to load/import the data into table storage from a csv file via azure storage explorer , but I am getting the following error as

An error occurred while opening the file 'D//sample.csv'.the required property 'Partitionkey' was not specified.

enter image description here

Kindly clarify the importance of Partitionkey and Rowkey in azure table storage?

4

4 Answers

2
votes

Azure Storage Key has been discussed here: Azure Table Storage Partition Key

In order to understand this, you will need to know what Partitions are. Whenever you upload something to Azure Storage, it is assigned to some partition. These partitions can be either on the same server or different server. The partitions can be moved across servers too. Lets assume that there are 5 servers in the pool and one of the servers (Server 2) is experiencing high load. Then Azure Storage will move the partition from Server 2 to another server to distribute the load evenly. It will also make this decision based on the size of data too.

In case of table storage, the user decides where the data is located. This is not the case for blobs or queues.

Therefore in table storage you will have to specify the partition key yourself.

I would suggest you to read these links in order to understand this topic further:

So in a way PartitionKey is used to specify on which partition you want to store your data. It acts as a unique identifier and forms a part of the Primary Key (first-half). RowKey is another attribute used to form the second half of the Primary Key. It identifies an entity in a given partition. So whenever you perform any opertion, you will need to specify both PartitionKey & RowKey.

Together the PartitionKey and RowKey uniquely identify every entity within a table.

2
votes

As Isaac Abraham mentioned each entity should have Partition Key and Row Key property and the combination of the two are unique for the table entity. It is mandatory. If we try to add the entity for the azure storage table with azure storage explorer tool we could see that,more detail please refer to the screenshot. enter image description here

So If we try to import the .csv file, the format of the file should be have Column named PartitionKey and RowKey. And the names are case sensitive. The following is the .csv file demo

PartitionKey,RowKey,Column1,Column2
test,x,testdata,testdata
test,xx,testdata,testdata
test,xxx,testdata,testdata
test2,x,testdata,testdata

enter image description here

Note: There are also some Azure storage table limitation we should know when try to import the data, more details please refer to the azure document.

  • Max size of a table entity 1 MB
  • Max number of properties in a table entity 252
2
votes

I recommend you change the region in Windows to English (U.S). So, you can save a spread-sheet as CSV-file with comma instead of semicolon as separator.

As example, if you are using Switzerland, you will get a CSV-file with semicolon as separator and azure will not find the Partitionkey.

0
votes

Partition Key and Row Key specify the unique index of the row; The combination of the two must be unique. I suggest reading up a little more here for more details of them.