Unable to insert nested json into cassandra
up vote
2
down vote
favorite
I am new in Cassandra. I have created one sample table. Right now facing problem during insert.
created employee like below :
create table employee(
emp_id int PRIMARY KEY,
first_name text,
last_name text,
department text,
skillswithrank map
);
Written query :
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', [{"nodejs":4},{"angularjs":4},{"expressjs":4}]);
I am stuck at this point.
node.js express cassandra cassandra-driver
add a comment |
up vote
2
down vote
favorite
I am new in Cassandra. I have created one sample table. Right now facing problem during insert.
created employee like below :
create table employee(
emp_id int PRIMARY KEY,
first_name text,
last_name text,
department text,
skillswithrank map
);
Written query :
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', [{"nodejs":4},{"angularjs":4},{"expressjs":4}]);
I am stuck at this point.
node.js express cassandra cassandra-driver
I am using Cassandra 3.4.4 version
– sameer vedpathak
Nov 22 at 9:30
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am new in Cassandra. I have created one sample table. Right now facing problem during insert.
created employee like below :
create table employee(
emp_id int PRIMARY KEY,
first_name text,
last_name text,
department text,
skillswithrank map
);
Written query :
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', [{"nodejs":4},{"angularjs":4},{"expressjs":4}]);
I am stuck at this point.
node.js express cassandra cassandra-driver
I am new in Cassandra. I have created one sample table. Right now facing problem during insert.
created employee like below :
create table employee(
emp_id int PRIMARY KEY,
first_name text,
last_name text,
department text,
skillswithrank map
);
Written query :
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', [{"nodejs":4},{"angularjs":4},{"expressjs":4}]);
I am stuck at this point.
node.js express cassandra cassandra-driver
node.js express cassandra cassandra-driver
edited Nov 22 at 11:25
Alex Ott
26.8k35072
26.8k35072
asked Nov 22 at 9:29
sameer vedpathak
163
163
I am using Cassandra 3.4.4 version
– sameer vedpathak
Nov 22 at 9:30
add a comment |
I am using Cassandra 3.4.4 version
– sameer vedpathak
Nov 22 at 9:30
I am using Cassandra 3.4.4 version
– sameer vedpathak
Nov 22 at 9:30
I am using Cassandra 3.4.4 version
– sameer vedpathak
Nov 22 at 9:30
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
You're trying to insert a list of maps, instead of map, so your insert doesn't match to table definition. Plus you're using incorrect syntax for strings in the map.
you need to write insert as:
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', {'nodejs':4, 'angularjs':4, 'expressjs':4]);
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
|
show 2 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You're trying to insert a list of maps, instead of map, so your insert doesn't match to table definition. Plus you're using incorrect syntax for strings in the map.
you need to write insert as:
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', {'nodejs':4, 'angularjs':4, 'expressjs':4]);
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
|
show 2 more comments
up vote
2
down vote
You're trying to insert a list of maps, instead of map, so your insert doesn't match to table definition. Plus you're using incorrect syntax for strings in the map.
you need to write insert as:
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', {'nodejs':4, 'angularjs':4, 'expressjs':4]);
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
|
show 2 more comments
up vote
2
down vote
up vote
2
down vote
You're trying to insert a list of maps, instead of map, so your insert doesn't match to table definition. Plus you're using incorrect syntax for strings in the map.
you need to write insert as:
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', {'nodejs':4, 'angularjs':4, 'expressjs':4]);
You're trying to insert a list of maps, instead of map, so your insert doesn't match to table definition. Plus you're using incorrect syntax for strings in the map.
you need to write insert as:
INSERT INTO company.employee(emp_id,first_name,last_name,department,skillswithrank )
VALUES (1,'sam', 'watson', 'IT', {'nodejs':4, 'angularjs':4, 'expressjs':4]);
answered Nov 22 at 11:29
Alex Ott
26.8k35072
26.8k35072
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
|
show 2 more comments
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
Thanks for the reply. company.employee is a demo table. I have another table, In that, I am trying to insert nested JSON. But I am unable to Insert.
– sameer vedpathak
Nov 22 at 12:25
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
please share the real table structure, what you want to insert, and what error you get - otherwise it's impossible to answer the question
– Alex Ott
Nov 22 at 12:31
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
Please refer below structure : create table company.executionInput ( ExecutionInputID bigint PRIMARY KEY, ExecutionLogID bigint, Acc_Type text, Email_Valid int, Country text, Customer_Accounts map<text,text>, CurrentOrder_List map<text,text> );
– sameer vedpathak
Nov 22 at 13:05
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I am getting error like : Invalid list literal for customer_accounts of type map<text, text>
– sameer vedpathak
Nov 22 at 13:06
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
I wrote in my answer that you have map declared in the table, but you're inserting a list of maps instead...
– Alex Ott
Nov 22 at 13:13
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427693%2funable-to-insert-nested-json-into-cassandra%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I am using Cassandra 3.4.4 version
– sameer vedpathak
Nov 22 at 9:30