在bigquery cli中使用SQL源文件 [英] Using a SQL source file with the bigquery cli

查看:76
本文介绍了在bigquery cli中使用SQL源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在bigquery CLI中使用输入文件?

Is it possible to use an input file with the bigquery CLI?

bq query < my_query.sql


推荐答案

你可以使用xargs:

If you're using unix (or have cygwin installed on windows), you can use xargs:

xargs -a my_query.sql -0 bq query

或者,您可以使用反标记:

Alternately you can use back-ticks:

bq query `cat my_query.sql`

请注意,bq只能处理一次执行一个命令 - 如果您的.sql脚本有多个查询,则需要将文件分割;

Note that bq can only process one command at a time -- if your .sql script has several queries, you'll need to split the file on ;

这篇关于在bigquery cli中使用SQL源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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