0

I tried creating table in cassandra using the following code in python

CREATE TABLE videos(
id uuid,
added_date TEXT,
title text,
PRIMARY KEY(id));

I tried to insert values using the following code

INSERT INTO videos(id,added_date,title)
VALUES(uuid(),"2014-01-29","Cassandra History");

I am getting the following error

SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 2:45 no 
viable alternative at input ',' (...,title)VALUES(uuid(),["2014-01-2]9",...)">
2
  • Try using single quotes around your string values. Commented Apr 24, 2016 at 17:59
  • @Ralf Thank you its working perfectly.I did not expect that the error will be due to quotes Commented Apr 25, 2016 at 2:18

1 Answer 1

1

As pointed out by @Ralf double quotes caused the error.When single quotes is used around the string it worked perfectly.

INSERT INTO videos(id,added_date,title)
VALUES(uuid(),'2014-01-29','Cassandra History');
Sign up to request clarification or add additional context in comments.

1 Comment

That helped me too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.