0
votes

I was importing around 200 rows of a exported table from a MySQL server. I didn't know that i needed a partition key and row key so I set it through the CSV making 2 new columns and filling them up with the table name. Than I imported the CSV. It showed me the first entry and it look fine so I imported it than midway I got a error saying N/A was not acceptable and it quit. Looking at the data imported it's completely off.

What did I do wrong?

I need to import about 200 more tables.

Sample Data: Not actual data as it's my user table (not relational)

Imported using Azure Table Storage Explorer

Columns: Name| Username| Email | Hash | Salt | ParitionKey| RowKey Row 1: Janet| admin| [email protected]| 203weg0897wg| 33&23j | site | site

That's pretty much how it went. But when I import the first row is fine than the columns mess up and than like username goes into partition key and stuff like that. It doesn't get imported into the right columns.

Yes I did put the table name as the partition key and row key. I did not realize that each entity needed it to be different. But I need to know which entity is from which table. Should I put them into separate partitions? I need them all in one table. What would be the solution?

1
Can you please update your question with the following information: 1) Sample data that you're importing (1st few rows should be fine), 2) please explain what you mean by Looking at the data imported it's completely off. and 3) How are you importing the data? Are you using some kind of tool to import?Gaurav Mantri
You said that you "set it through the CSV making 2 new columns and filling them up with the table name". Did you use the table name for both the partition key and the row key? These two columns form the table's primary key, so the combination of the two needs to be unique for each entity in the table.Tamra Myers - Microsoft

1 Answers

3
votes

But when I import the first row is fine than the columns mess up and than like username goes into partition key and stuff like that. It doesn't get imported into the right columns.

If you import .CSV to Azure Table Storage by using Azure Storage Explorer, then the data structure of your .CSV file should look like as follows:

| PartitionKey | RowKey | Name  | UserName | Email           | Hash          | Salt   |
| ------------ | ------ | ----- | -------- | --------------- | ------------- | ------ |
| site         | site   | Janet | admin    | [email protected] | 203weg0897wg  | 33&23j |

Note: PartitionKey need to be placed in the first column and the RowKey need to be placed behind it.

I need to import about 200 more tables. But I need to know which entity is from which table. Should I put them into separate partitions? I need them all in one table.

According to your requirement, you could set the partition key as your table name and set the row key as the identification of the entity in the associated table. As Tamra said, the partition key and row key need to be unique for each entity in a azure table.

In order to import about 200 more tables into a azure table, you could export data from your MYSQL table and modify the data structure in the .CSV file, then import the .CSV to azure table one by one. For a better understanding of Azure Storage Table design, you could refer to this tutorial.

Additionally, you could import a CSV file to Azure Table Storage by using PowerShell script or Azure Storage Client Library for your development language.