sql(impala)查询语法错误

yv5phkfx  于 2021-06-26  发布在  Impala
关注(0)|答案(1)|浏览(436)

我使用以下查询查找给定时间戳约束的数据:

query = 'select my_id, my_ts from my_table limit 100 where my_ts >  "2016-05-13 00:00:00"'
cursor = impala_con.cursor()
cursor.execute('USE my_database')
cursor.execute(query)

但出现以下错误:

HiveServer2Error: AnalysisException: Syntax error in line 1:
...my_ts from my_table limit 100 where my_ts >  "201...
                             ^
Encountered: WHERE
Expected: AND, BETWEEN, DIV, ILIKE, IN, IREGEXP, IS, LIKE, LIMIT, NOT, OFFSET, OR, ORDER, REGEXP, RLIKE, UNION

CAUSED BY: Exception: Syntax error

有人知道我做错了什么吗?谢谢!

oewdyzsn

oewdyzsn1#

根据您需要指定的文档 limit 100 在where子句之后。

query = 'select my_id, my_ts from my_table where my_ts >  "2016-05-13 00:00:00" limit 100'

相关问题