Escaping delimiter in BQ

巧了我就是萌 提交于 2020-01-05 07:08:44

问题


I have a ton of files which are delimited by |, however, they have | as values in the fields as well. the | in the data has been escaped with \ but I don't think BQ is picking it up, is this something I can fix without having to open every single file, and updating? there are 2-3000 files and are all zipped, so doing it one by one is not at all practical.


回答1:


  1. Read each row as a whole line (CSV, with a weird character delimiter).
  2. Parse in BigQuery - either via REGEX or JavaScript UDF.

I describe a similar approach here:

  • https://medium.com/google-cloud/bigquery-lazy-data-loading-ddl-dml-partitions-and-half-a-trillion-wikipedia-pageviews-cd3eacd657b6


来源:https://stackoverflow.com/questions/51429988/escaping-delimiter-in-bq

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