将字符串操作的输出写入 Azure Data lake Store Item
Writing output of String manipulation to Azure Data lake Store Item
当我尝试将 Get-AzureRmDataLakeStoreItemContent 输出的字符串操作的输出写入变量并尝试将其传递给 New-AzureRmDataLakeStoreItem 时出现错误 "New-AzureRmDataLakeStoreItem : Invalid content passed in. Only byte[] and string content is supported."
我验证了 Get-command 的输出是一个对象,但我不明白为什么我无法传递它。我不确定我是否需要像哈希表这样的更多转换来存储到 Azure Data lake store 的输出中。还是编码问题。请帮忙破译这个错误
这是代码,我还附上了错误的屏幕截图。
原始输入
1|2|3|a,b,
3|4|5|d,h,
字符串操作的输出
1|2|3|a,b
3|4|5|d,h
$data=((Get-AzureRmDataLakeStoreItemContent -Account $accountName -Path $myrootdir/V_FQP_ITC_11_VEHICLE/test.csv).ToString() -split("`r")).Trim() | ForEach-Object {$_.TrimEnd(",")}
New-AzureRmDataLakeStoreItem -Account $accountName -path $myrootdir/test_output.txt -Value $data
看来你需要添加一个 ""
的 $data
,它对我有效。
New-AzureRmDataLakeStoreItem -Account "joydatalake1" -path "/sss/test_output.txt" -Value "$data"
当我尝试将 Get-AzureRmDataLakeStoreItemContent 输出的字符串操作的输出写入变量并尝试将其传递给 New-AzureRmDataLakeStoreItem 时出现错误 "New-AzureRmDataLakeStoreItem : Invalid content passed in. Only byte[] and string content is supported."
我验证了 Get-command 的输出是一个对象,但我不明白为什么我无法传递它。我不确定我是否需要像哈希表这样的更多转换来存储到 Azure Data lake store 的输出中。还是编码问题。请帮忙破译这个错误
这是代码,我还附上了错误的屏幕截图。 原始输入
1|2|3|a,b,
3|4|5|d,h,
字符串操作的输出
1|2|3|a,b
3|4|5|d,h
$data=((Get-AzureRmDataLakeStoreItemContent -Account $accountName -Path $myrootdir/V_FQP_ITC_11_VEHICLE/test.csv).ToString() -split("`r")).Trim() | ForEach-Object {$_.TrimEnd(",")}
New-AzureRmDataLakeStoreItem -Account $accountName -path $myrootdir/test_output.txt -Value $data
看来你需要添加一个 ""
的 $data
,它对我有效。
New-AzureRmDataLakeStoreItem -Account "joydatalake1" -path "/sss/test_output.txt" -Value "$data"