I am trying to query my cassandra database to return data from a list of names held on an array server side. This is held as an array. I know the data I am accessing is stored as a string in my database and so I have appended single quotes around it (I have tried with and without this but no luck).
Here is my query.
const arr = ["ukcust1","ukcust2","ukcust5"];
//Here I append single quotes before and after to each string if needed
const query = "SELECT * FROM table_name WHERE name = ?";
client.execute(query, arr, { prepare:true }, function (err, result) {
..//Code
};
What am I missing here? I want the query to be:
SELECT * FROM table_name WHERE name = each of the names in the array 'arr';
)". But if you do this, you might start to query on several partitions which it's not the best. I recommend this to read https://lostechies.com/ryansvihla/2014/09/22/cassandra-query-patterns-not-using-the-in-query-for-multiple-partitions/ and this http://batey.info/cassandra-anti-pattern-distributed.html
– Horia May 14 '18 at 13:28