Google Bigquery BQ 命令行从文件执行查询 [英] Google Bigquery BQ command line execute query from a file

查看:19
本文介绍了Google Bigquery BQ 命令行从文件执行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 bq 命令行工具来运行查询,例如:

I use the bq command line tool to run queries, e.g:

bq query "select * from table"

如果我将查询存储在文件中并从该文件运行查询会怎样?有没有办法做到这一点?

What if I store the query in a file and run the query from that file? is there a way to do that?

推荐答案

其他答案似乎要么过时,要么过于脆弱.截至 2019 年,bq query 从 stdin 读取,因此您可以将文件重定向到其中:

The other answers seem to be either outdated or needlessly brittle. As of 2019, bq query reads from stdin, so you can just redirect your file into it:

bq query < myfile.sql

查询参数是这样传递的:

Query parameters are passed like this:

bq query --parameter name:type:value < myfile.sql

这篇关于Google Bigquery BQ 命令行从文件执行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆