Balajee
Balajee

Reputation: 143

Insert into in python cql throwing syntax error

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",...)">

Upvotes: 0

Views: 1005

Answers (1)

Balajee
Balajee

Reputation: 143

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');

Upvotes: 1

Related Questions