我正在尝试将Azure表存储查询结果写入.csv文件并将其本地存储在计算机上(temp是好的).我能够毫无问题地查询-然后在messageBox中显示结果.我使用c#做到这一点.我不想使用外部应用程序,但如果需要的话会调用powershell脚本.最终,我试图下载csv,所以我查询csv文件而不是Azure表存储以获得更多功能。(SQL Server目前不是一个选择-尽管我知道它会让我的生活变得更容易)
CloudStorageAccount storageAccount =
CloudStorageAccount.Parse ("DefaultEndpointsProtocol=https;AccountName=MyStorageAccountNameHere;AccountKey=MyTableKeyhere
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("TelephonyIssueLog");
var managerQuery = new TableQuery<IssueEntity>().Where(TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, "Issues"));
System.IO.File.WriteAllText(@"C:\temp\csv.csv", managerQuery);
3条答案
按热度按时间nwnhqdif1#
其实我已经想通了:从顶部开始
然后是查询和CSV编辑:
工作起来很有魅力!
eqoofvh92#
为了简单起见,我建议您使用名为ServiceStack.Text的第三方库来实现您的目的。在从Azure表中筛选数据后,您可以尝试添加以下代码:
dffbzjpn3#
我为Azure.Data.Tables SDK编写了一个小扩展,以简化与Azure Storage Explorer兼容的CSV导出:
源代码nuget