Since, cassandra supports map type. I want to insert a python dict into cassandra. I tried this:
cql = "Insert into table_name (my_key, name, my_dict) values (%s, %s, %s)" % (my_key, name, my_dict)
session.execute(cql)
This obviously didn't work.
I already have a map type column in my column family. How do I go about it?
Error: TypeError: not all arguments converted during string formatting
Use parameter passing form instead of string interpolation:
cql = "Insert into table_name (my_key, name, my_dict) values (%s, %s, %s)"
session.execute(cql, (my_key, name, my_dict))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.