zhares
zhares

Reputation: 13

cassandra query with data parameter failing

I'm using ruby-driver to connect to cassandra, when I tried to execute the SQL with parameters it keeps failing, because it doesn't recognize "date" as valid.

Is there a proper way to do this?

I'm doing something like this:

sql = 'select event_id, event_name, event_date from events where event_date = ?'
event_params = ['2017-03-18']
connection.execute(sql, arguments: event_params)

This returns an error:

Cassandra::Errors::InvalidError: Expected 4 byte long for date (10)

is there a way to validate this parameter as a Date instead as a string?

my schema is like this:

CREATE TABLE events (
  event_id bigint,
  event_date date,
  title text,
  PRIMARY KEY (event_id, event_date)
); 

Upvotes: 1

Views: 256

Answers (0)

Related Questions