ITADN

Bigquery can only handle legacy SQL

#207OpenGaryLiuTelus 创建于 2025-05-15
G
GaryLiuTeluscommented
Bigquery now is mainly non-legacy SQL, so it should include `--use_legacy_sql=false` parameter (https://cloud.google.com/bigquery/docs/bq-command-line-tool). my current url is `bigquery:?project_id=xxx&dataset_id=xxxx&use_legacy_sql=false` currently, dadbod wrap the final command as `bq --project_id=xxx --dataset_id=xxxx --use_legacy_sql=false query 'actual SELECT clause'`, https://github.com/tpope/vim-dadbod/blob/e95afed23712f969f83b4857a24cf9d59114c2e6/autoload/db/adapter/bigquery.vim#L25 but this will throw an error: `FATAL Command 'use_legacy_sql=false' unknown`. According to the official document above, the `bq` command should be with `query` together and then other parameters, like `bq query --project_id=xxx --use_legacy_sql=false 'actual SELECT'` Please see below comparisons ![Image](https://github.com/user-attachments/assets/408553e4-e727-4902-969e-23c77e5affec) <<=============**Edit**=================>> https://cloud.google.com/bigquery/docs/bq-command-line-tool#positioning_flags_and_arguments For `bq` command, there are global flags and command-specific flags. `--use_legacy_sql=false` is command-specific flag (for `query` command) so it should be put after `query` command. ![Image](https://github.com/user-attachments/assets/ee81732f-722f-4f27-9e7f-93f19f752e22)
1 条评论