Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no "IN"-type query in the Thrift API. You could perform a series of <code>get</code> queries for each composite column value (<code>day_of_year</code>, <code>minute_of_day</code>, <code>event_id</code>). </p> <p>If your <code>event_id</code>s were sequential (and your question says they are not) you could perform a single <code>get_slice</code> query, passing in the range (e.g., <code>day_of_year</code>, <code>minute_of_day</code>, and range of <code>event_id</code>s). You could grab bunches of them in this way and filter the response programatically yourself (e.g., grab all data on the date with event ids between 4-3433). More data transfer, more processing on the client side so not a great option unless you really are looking for a range.</p> <p>So, if you want to use "IN" with Cassandra you will need to switch to a CQL-based solution. If you are considering using CQL in python another option is <a href="https://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/" rel="nofollow">cassandra-dbapi2</a>. This worked for me:</p> <pre><code>import cql # Replace settings as appropriate host = 'localhost' port = 9160 keyspace = 'keyspace_name' # Connect connection = cql.connect(host, port, keyspace, cql_version='3.0.1') cursor = connection.cursor() print "connected!" # Execute CQL cursor.execute("select * from data_bucket where day_of_year = 266 and minute_of_day = 244 and event_id in (4, 7, 11, 1990, 3433)") for row in cursor: print str(row) # Do something with your data # Shut the connection cursor.close() connection.close() </code></pre> <p>(Tested with Cassandra 2.0.1.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload