如何在齐柏林飞艇中运行cql,以用户输入格式进行输入?

kyxcudwk  于 2021-06-13  发布在  Cassandra
关注(0)|答案(1)|浏览(401)

我试图通过在zeppelin中采用用户输入格式来运行cql查询tool:-

%cassandra

SELECT  ${Select Fields Type=uuid ,uuid | created_by |  email_verify| username} FROM 
${Select Table=keyspace.table_name} 
${WHERE email_verify="true" } ${ORDER BY='updated_date' }LIMIT ${limit = 10};

运行此查询时出现以下错误:

line 4:0 mismatched input 'true' expecting EOF 
   (SELECT uuid FROM keyspace.table_name ["true"]...)
vdzxcuhz

vdzxcuhz1#

你得走了 WHERE 以及 ORDER BY 在动态表单声明之外。
输入字段声明如下所示: ${field_name=default_value} . 在你的情况下,而不是 WHERE ... ,您已获得 WHERE email_verify .
应如下所示(未测试):

%cassandra

SELECT ${Select Fields Type=uuid ,uuid | created_by |  email_verify| username} FROM 
${Select Table=keyspace.table_name} 
WHERE ${where_cond=email_verify='true'} ORDER BY ${order_by='updated_date'} LIMIT ${limit = 10};

更新:
以下是具有以下结构的表的工作示例:

CREATE TABLE test.scala_test2 (
    id int,
    c int,
    t text,
    tm timestamp,
    PRIMARY KEY (id, c)
) WITH CLUSTERING ORDER BY (c ASC)

相关问题