Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert json object as string in cassandra table #1026

Open
prasadgsk opened this issue Sep 5, 2018 · 1 comment
Open

insert json object as string in cassandra table #1026

prasadgsk opened this issue Sep 5, 2018 · 1 comment

Comments

@prasadgsk
Copy link

Hi,

I want to insert this entire json structure as String in cassandra table. How can i do it?

"testResult": "{"apiVersion":"v1","items":[{"name":"srehelloworld-0-0-1-d2a-5bb4df7-jqtqd","namespace":"com-xyz-resiliency-dev","clusterName":null,"uid":"8f1db6b67-11e8-8525-fa163e02ebbc","labels":{"app":"HelloWorld","pod-template-hash":"1665370893","routeoffer":"X1A","version":"0.0.1"},"annotations":{"GRM_NS":"com-xyz-resiliency-dev","kubernetes.io/created-by":"{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"ReplicaSet\",\"namespace\":\"com-xyz-resiliency-dev\",\"name\":\"helloworld-0-0-1-d2a-5b7c4df7\",\"uid\":\"c36f6fee-9b57-11e8-b334-fa163e12181e\",\"apiVersion\":\"extensions\",\"resourceVersion\":\"205648472\"}}\n","kubernetes.io/psp":"restricted-with-root","prometheus.io/port":"8000","prometheus.io/scrape.ne":"true","seccomp.security.alpha.kubernetes.io/pod":"docker/default"},"spec":{"containers":[{"readinessProbe":null}]}}],"kind":"PodList","metadata":{"resourceVersion":"2204579","selfLink":"/api/v1/namespaces/com-xyz-resiliency-dev/pods","continue":null}}"

I declared it as String, but getting this exception.

Caused by: InvalidRequestException(why:Invalid STRING constant ({"apiVersion":"v1"......) for "testResult" of type blob)
at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result$execute_cql3_query_resultStandardScheme.read(Cassandra.java:50297)
at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result$execute_cql3_query_resultStandardScheme.read(Cassandra.java:50274)
at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result.read(Cassandra.java:50189)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_cql3_query(Cassandra.java:1734)
at org.apache.cassandra.thrift.Cassandra$Client.execute_cql3_query(Cassandra.java:1719)
at com.impetus.client.cassandra.CassandraClientBase.execute(CassandraClientBase.java:2341)
... 103 mor
Thanks,
Prasad

@devender-yadav
Copy link
Contributor

Hi @prasadgsk,

I tried to replicate your issue at my end with Kundera 3.13 and Casandra 3.11.3 and its working fine.

I downloaded the sample project from https://github.com/Impetus/Kundera#sample-projects

Maybe you can try with this sample project and let me know if you are still facing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants