bq命令行工具:当文字中包含">"或"<" [英] bq command-line tool: query fails when text includes " > " or " < "

查看:38
本文介绍了bq命令行工具:当文字中包含">"或"<"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用bq命令行工具运行包含>或<的查询时遇到问题.象征.

I'm having problems using the bq command-line tool to run queries that contain a > or < symbol.

下面的前两个示例显示,当我尝试从id> 300的表中选择行时,什么也不会返回,但是当我为id = 301选择时,我得到了结果.

The first two examples below show that when I try to select rows from a table where id > 300 nothing is returned, yet when I select for id=301 I get a result.

后两个示例表明,当我尝试选择id<300我收到语法错误,但是当我为id = 299选择时,我得到一个结果.

The second two examples show that when I try to select rows where id < 300 I get a syntax error, but when I select for id=299 I get a result.

有人知道为什么会这样以及如何解决吗?

Does anyone know why this is happening and how to fix it?

非常感谢,

史蒂夫

C:\ Users \ stephen.caruana> bq查询从test.test_1 WHERE ID> 300 LIMIT 5的SELECT sk_id中选择"正在等待bqjob_r56794831_000001585450df31_1 ...(0s)当前状态:完成

C:\Users\stephen.caruana>bq query "SELECT sk_id from test.test_1 WHERE id > 300 LIMIT 5" Waiting on bqjob_r56794831_000001585450df31_1 ... (0s) Current status: DONE

C:\ Users \ stephen.caruana> bq查询从test.test_1 WHERE id = 301 LIMIT 5中选择sk_id"等待上bqjob_r03e25be0_0000015854521a94_1 ...(3s)当前状态:DONE+ ------- +|sk_id |+ ------- +|301 |+ ------- +

C:\Users\stephen.caruana>bq query "SELECT sk_id from test.test_1 WHERE id = 301 LIMIT 5" Waiting on bqjob_r03e25be0_0000015854521a94_1 ... (3s) Current status: DONE +-------+ | sk_id | +-------+ | 301 | +-------+

C:\ Users \ stephen.caruana> bq查询从test.test_1 WHERE ID< 300 LIMIT 5中选择sk_id"正在等待bqjob_r1615cc38_000001585451837a_1 ...(0s)当前状态:DONE查询字符串中的错误:错误处理作业'itg-creator-lgi-ecrm:bqjob_r1615cc38_000001585451837a_1':WHERE子句不是布尔表达式(位于int64中)

C:\Users\stephen.caruana>bq query "SELECT sk_id from test.test_1 WHERE id < 300 LIMIT 5" Waiting on bqjob_r1615cc38_000001585451837a_1 ... (0s) Current status: DONE Error in query string: Error processing job 'itg-creator-lgi-ecrm:bqjob_r1615cc38_000001585451837a_1': WHERE clause is not a boolean expression (found int64)

C:\ Users \ stephen.caruana> bq查询从test.test_1 WHERE id = 299 LIMIT 5中选择sk_id"正在等待bqjob_r7e6824a9_000001585452ba30_1 ...(2s)当前状态:DONE+ ------- +|sk_id |+ ------- +|299 |+ ------- +

C:\Users\stephen.caruana>bq query "SELECT sk_id from test.test_1 WHERE id = 299 LIMIT 5" Waiting on bqjob_r7e6824a9_000001585452ba30_1 ... (2s) Current status: DONE +-------+ | sk_id | +-------+ | 299 | +-------+

推荐答案

这是Windows命令提示符问题.您需要转义>"和<"带有"^"的符号,否则命令提示符会认为这是输出的重定向.因此,您的命令应如下所示:

It's a Windows command prompt issue. You need to escape the ">" and "<" symbols with "^", otherwise command prompt thinks it's a redirect of the output. So your command should look like

bq查询从test.test_1 WHERE ID ^> 300 LIMIT 5中选择sk_id"

这篇关于bq命令行工具:当文字中包含"&gt;&quot;或"&lt;&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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