Unable to insert nested json into cassandra












2















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.










share|improve this question

























  • I am using Cassandra 3.4.4 version

    – sameer vedpathak
    Nov 22 '18 at 9:30
















2















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.










share|improve this question

























  • I am using Cassandra 3.4.4 version

    – sameer vedpathak
    Nov 22 '18 at 9:30














2












2








2


1






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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 11:25









Alex Ott

27.7k35173




27.7k35173










asked Nov 22 '18 at 9:29









sameer vedpathaksameer vedpathak

164




164













  • I am using Cassandra 3.4.4 version

    – sameer vedpathak
    Nov 22 '18 at 9:30



















  • I am using Cassandra 3.4.4 version

    – sameer vedpathak
    Nov 22 '18 at 9:30

















I am using Cassandra 3.4.4 version

– sameer vedpathak
Nov 22 '18 at 9:30





I am using Cassandra 3.4.4 version

– sameer vedpathak
Nov 22 '18 at 9:30












1 Answer
1






active

oldest

votes


















2














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





share|improve this answer
























  • 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 '18 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 '18 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 '18 at 13:05













  • I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

    – sameer vedpathak
    Nov 22 '18 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 '18 at 13:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














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





share|improve this answer
























  • 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 '18 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 '18 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 '18 at 13:05













  • I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

    – sameer vedpathak
    Nov 22 '18 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 '18 at 13:13
















2














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





share|improve this answer
























  • 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 '18 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 '18 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 '18 at 13:05













  • I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

    – sameer vedpathak
    Nov 22 '18 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 '18 at 13:13














2












2








2







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





share|improve this answer













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






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 11:29









Alex OttAlex Ott

27.7k35173




27.7k35173













  • 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 '18 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 '18 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 '18 at 13:05













  • I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

    – sameer vedpathak
    Nov 22 '18 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 '18 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 '18 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 '18 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 '18 at 13:05













  • I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

    – sameer vedpathak
    Nov 22 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 13:05















I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

– sameer vedpathak
Nov 22 '18 at 13:06







I am getting error like : Invalid list literal for customer_accounts of type map<text, text>

– sameer vedpathak
Nov 22 '18 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 '18 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 '18 at 13:13


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'