问题
I have a strange problem here. I have a cassandra table called events_prime
and I want to request the DB to get elements from this table with a WHERE clause.
I am using the python cassandra-driver
and this is my request:
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
The output:
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)
That means that there is no data with the given constraints!
BUT when I run 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;
(which is the same query in python driver ) directly in cql I get 100 rows?
Any explanation? Thanks in advance
来源:https://stackoverflow.com/questions/35880249/cassandra-the-same-query-work-with-cql-but-not-with-python-driver