问题
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