Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

kokoluciferus avatar image
kokoluciferus asked ·

Invalid string constant error when inserting into UDT column using python driver

I am doing the Normalization exercise on DS220 using python driver from local PC.

I created UDT type as shown:

1621242681884.png

I also created videos_by_actor table as shown:

1621242769732.png

I am using python to extract csv data into cassandra videos_by_actor table as shown:

1621243080370.png

The following error is being generated:

1621243180064.png


The error reads: Invalid string constant. with the encoding column in the csv file covered in parentheses. However, when I printed the encoding column out from csv, it is in curly braces which is normal for the UDT I am creating.

Is this a bug in cassandra python driver? I have ensured to follow the documentation in properly creating encoding UDT type with type frozen<video_encoding>. Is there anything I am missing here?


Finally, If I wanna use Astra for learning purposes, Is there any resource I can use to get started. More importantly, I will like to document my every step in Astra from table creation to insertion and querying just like I would using a python script.


I will appreciate assistance in debugging this issue!

udt
1621242681884.png (16.3 KiB)
1621242769732.png (30.6 KiB)
1621243080370.png (92.3 KiB)
1621243180064.png (79.8 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

I'd like to make a friendly request and ask that you paste the outputs in text instead of screenshots. A lot of the engineers who answer questions here respond during their free time on their mobile devices and screenshots are very difficult to read.

It would make it easier to help you if you paste the text instead. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.