Writing output of String manipulation to Azure Data lake Store Item

落花浮王杯 提交于 2019-12-25 01:36:09

问题


When I try to write an output of a String manipulation of Get-AzureRmDataLakeStoreItemContent output to a variable and try to pass it in a variable to New-AzureRmDataLakeStoreItem i am getting error "New-AzureRmDataLakeStoreItem : Invalid content passed in. Only byte[] and string content is supported."

I verified that the output of Get-command is an Object but I dont understand why i am not able to pass it. I am not sure whether I need some more transformation like a Hashtable to store into an output in Azure Data lake store. Or is it an Encoding problem. Please help in deciphering this error

Here is the code and i am also attaching a screenshot of the error. Original input

1|2|3|a,b,
3|4|5|d,h,

Output of String manipulation

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 


回答1:


Seems you need to add a "" of $data, it works on my side.

New-AzureRmDataLakeStoreItem  -Account "joydatalake1" -path "/sss/test_output.txt" -Value "$data"



来源:https://stackoverflow.com/questions/53533224/writing-output-of-string-manipulation-to-azure-data-lake-store-item

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!