Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: cannot concatenate 'str' and 'UUID' objects

I am trying to update the column in cassendra using python script.

but i am getting error TypeError: cannot concatenate 'str' and 'UUID' objects

active = session.execute("select id, status from address where status = 'A'")

for row in activeCampaigns:
    session.execute("update address set status = 'ACTIVE' where id = "+row.id);

could someone assist me in resolving this issue?

like image 432
Hari Avatar asked Mar 01 '26 12:03

Hari


1 Answers

row.id is most likely a UUID object. You should try either converting it to its string representation before concatenation:

session.execute("update ... id = " + str(row.id))

or use proper string formatting:

session.execute("update ... id = {}".format(row.id))
like image 105
user2390182 Avatar answered Mar 04 '26 09:03

user2390182



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!