cassandra - 相同的查询使用cql而不是python驱动程序

时间:2016-03-08 23:41:13

标签: python cassandra cql cql3

我这里有一个奇怪的问题。我有一个名为events_prime的cassandra表,我想请求DB使用WHERE子句从此表中获取元素。

我正在使用python cassandra-driver,这是我的要求:

prep_stment = session.prepare("""
    SELECT * FROM events_prime WHERE "websiteId" = '%s-%s' AND churner=True AND "currentTime" > '%s' AND "currentTime" < '%s' LIMIT 20000;
    """%(platform,client,time_2,time_1))
    print prep_stment
    print "Request DB..."
    frames = []
    for res in session.execute(prep_stment):
        frames.append(pd.DataFrame(res))
    df = pd.concat(frames)
    print df.shape

输出:

Out[1]: Request cassandra...
Out[2]: <PreparedStatement query="
    SELECT * FROM events_prime WHERE "websiteId" = 'sd-8231' AND churner=True AND "currentTime" > '2016-03-08 21:32:14' AND "currentTime" < '2016-03-08 23:32:14' LIMIT 20000;
    ", consistency=Not Set>
Out[3]: Request DB...

Out[4]: (0, 31)

这意味着没有给定约束的数据!

但是当我在cql中直接运行SELECT * FROM events_prime WHERE "websiteId" = 'sd-8231' AND churner=True AND "currentTime" > '2016-03-08 21:32:14' AND "currentTime" < '2016-03-08 23:32:14' LIMIT 20000;(在python驱动程序中是相同的查询)时我得到100行?

任何解释?提前致谢

0 个答案:

没有答案