How can I pass tuple with only one element as param in sql query Python?
I have tried this solution suggested here: imploding a list for use in a python MySQLDB IN clause
ids = [(UUID('1232a4df-5849-46c2-8c76-74fe74168d82'),)] # list of ids
cursor.execute('''
SELECT
...
WHERE
id IN %(ids)s
AND created_at > %(start_dt)s
''', {
'ids': tuple(ids), 'start_dt': '2019-10-31 00:00:00'
})
but this solution does not work in python 3 and mysql-connector-python 8.0.21. I get this error:
An error "Python tuple cannot be converted to MySQL type" is returned.