【问题标题】:Dynamic selection of storage table in azure data factoryazure数据工厂中存储表的动态选择
【发布时间】:2015-12-27 02:25:08
【问题描述】:
我有一组现有的 Azure 存储表,每个客户端一个,用于在多租户云系统中保存事件。
例如,可能有 3 个表来保存登录信息:
ClientASignins
客户端登录
客户端CSignins
有没有办法在复制操作或类似 Pig 脚本的过程中动态循环这些内容?
或者有其他方法可以达到这个效果吗?
非常感谢!
【问题讨论】:
标签:
azure
apache-pig
azure-storage
azure-hdinsight
azure-data-factory
【解决方案1】:
如果您在其他位置(如 Azure 存储)跟踪这些表,则可以使用 PowerShell 循环遍历它们并在每个位置上创建一个配置单元表。例如:
foreach($t in $tableList) {
$hiveQuery = "CREATE EXTERNAL TABLE $t(IntValue int)
STORED BY 'com.microsoft.hadoop.azure.hive.AzureTableHiveStorageHandler'
TBLPROPERTIES(
""azure.table.name""=""$($t.tableName)"",
""azure.table.account.uri""=""http://$storageAccount.table.core.windows.net"",
""azure.table.storage.key""=""$((Get-AzureStorageKey $storageAccount).Primary)"");"
Out-File -FilePath .\HiveCreateTable.q -InputObject $hiveQuery -Encoding ascii
$hiveQueryBlob = Set-AzureStorageBlobContent -File .\HiveCreateTable.q -Blob "queries/HiveCreateTable.q" `
-Container $clusterContainer.Name -Force
$createTableJobDefinition = New-AzureHDInsightHiveJobDefinition -QueryFile /queries/HiveCreateTable.q
$job = Start-AzureHDInsightJob -JobDefinition $createTableJobDefinition -Cluster $cluster.Name
Wait-AzureHDInsightJob -Job $job
#INSERT YOUR OPERATIONS FOR EACH TABLE HERE
}
研究:
http://blogs.msdn.com/b/mostlytrue/archive/2014/04/04/analyzing-azure-table-storage-data-with-hdinsight.aspx
How can manage Azure Table with Powershell?