google-bigquery Error while specifying pipe delimiter in bq load command on windows

ぃ、小莉子 提交于 2020-01-15 09:50:07

问题


I am trying to load a PIPE delimited file and running bq load command from windows platform. It is not accepting pipe delimiter in the command.

E.g. I am trying to use -F operator to specify the delimiter and could specify space delimiter but it stops working when I specify pipe delimiter.

C:\Windows>bq load -F" " "cmdwh_bq_prod.testtabPIPE"  "c:\temp\testPIPE.txt" PlatformVersion:int64,AnalyticsSessionID:int64,OutletGroup:string
Upload complete.
..... rest of the processing......
..... rest of the processing......

But same command stops working when I specify pipe delimiter...

C:\Windows>bq load -F"|" "cmdwh_bq_prod.testtabPIPE"  "c:\temp\testPIPE.txt" PlatformVersion:int64,AnalyticsSessionID:int64,OutletGroup:string
The filename, directory name, or volume label syntax is incorrect.

C:\Windows>

Please suggest.


回答1:


Found the solution. Caret(^) is the answer. Just put a caret right before pipe operator on command prompt and it will work.

C:\Users\adm_ratneshs>bq load -F"^|" cmdwh_bq_prod.testtabPIPE  e:\ETL\Data\BigQuery\Out\testPIPE.txt PlatformVersion:int64,AnalyticsSessionID:int64,OutletGroup:string
Upload complete.
Waiting on bqjob_r422161ad_00000162dbcd5ce2_1 ... (1s) Current status: DONE

C:\Users\adm_ratneshs>



回答2:


This works for me:

bq load --source_format=CSV --field_delimiter="|" dataset.tablename gs://bucket/foldername/filename.txt ./myschema.json



来源:https://stackoverflow.com/questions/49911415/google-bigquery-error-while-specifying-pipe-delimiter-in-bq-load-command-on-wind

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