1
votes

I am trying to copy myTable from azure to local emulator

AzCopy.exe /Source:https://teststorage.table.core... /Dest:http://127.0.0.1:10002/devstoreaccount1/myTable /sourceKey:VUGXYOrFUG8+f7KYt5etrjB4B/3QbwWiJgLZ6wXCdx6p+bV/GTfCLJshpWQvFZNChXtPbR2llqvbXIB9qucSJQ== /destkey:Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== /destType:table /S

I have this error : The syntax of the command is incorrect. Copying data from one table to another is not supported by either the Azure Table service or AzCopy.

Can anyone tell me where is the issue with my command ?

3
I don't think it is even supported. You can copy data from a table to a local file or a blob container but not a table itself.Gaurav Mantri
did you explicitly defined /sourceType and /destinationType as per: azure.microsoft.com/en-us/documentation/articles/…astaykov

3 Answers

8
votes

So far AzCopy doesn't support copying table to table directly. To work around it, you can run two commands to firstly export the source table to local or blob, and then import back to the target table.

BTW, /S is an option only available for blob/file copying, you can't specify it for table copying.

AzCopy.exe /Source:https://youraccount1.table.core.windows.net/srctable /SourceKey:key1 /Dest:D:\LocalFolder /Manifest:yourfilename /SplitSize:128

AzCopy.exe /Source:D:\LocalFolder /Dest:http://127.0.0.1:10002/devstoreaccount1/desttable /DestType:Table /DestKey:key2 /Manifest:yourfilename /EntityOperation:InsertOrReplace

1
votes

If you are still looking for a solution for this problem, please look at a package I released on NuGet AzureTableUtilities

You can copy a table to a file or blob file, restore a table from a file or blob file as well as copy to another table on the same account or a different account. Filtering on PartitionKey and Timestamp is also available.

I also created a reference command line code base and put it on GitHub which allows this to be executed from a command line or Docker container.

Let me know if this doesn't quite match what you want, and I'll see if I can enhance the functionality.

0
votes

If you are still looking for the solution. I have achieved this by AZCopy. Please check the C# code below

  1. Download and Install the AzCopy
  2. Use library ( using System.Diagnostics;)
  3. Write below code

Process process1 = new Process();
process1.StartInfo.FileName = @"" + string.Concat(azCopyExePath, "\\", "AzCopy.exe");
process1.StartInfo.Arguments = " /Source:" + "https://" + storageAccountName +
                        ".table.core.windows.net/" + tableName+ " /SourceKey:" 
                        + storageAccessKey + " /Dest:C:\temp" /Manifest:" + fileName + " /SplitSize:128";
process1.StartInfo.CreateNoWindow = true;
process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process1.Start();
process1.WaitForExit();
process1.Close();