Bug #116823 Python connector with prepared statements cannot be used with lists
Submitted: 28 Nov 2024 16:54 Modified: 29 Nov 2024 10:50
Reporter: Miguel Garcia Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:9.1.0 OS:Any (I'm using Ubuntu 24.04)
Assigned to: CPU Architecture:Any (I'm using AMD64)

[28 Nov 2024 16:54] Miguel Garcia
Description:
I've tried to run a prepared statement like this:

```
emails = ["example1@example.com", "example2@example.com"]
query = f"update example set field="value" where email in ?"
cursor = cnx.cursor(prepared=True)                      
try:                                                         
    cursor.execute(query, (emails,))                               
finally:                                                     
    cnx.commit()                                        
    cursor.close()                                           

```

But it doesn't work. I tried different options, but I always have an error and I don't get it working. Finally I generated as many "?" as parameters to introduce them individually, but I find that solution a bit hard to understand in the future.

How to repeat:
just try to use the "in" SQL statement with a list of items.
[29 Nov 2024 10:50] MySQL Verification Team
Hi Mr. Garcia,

Thank you for your bug report.

Let us inform you that this is a forum for reporting bugs with a fully repeatable test cases.

This is not a forum for seeking advice or asking questions.

We have a forum for the free support and you can find it here:

https://forums.mysql.com/

Not a bug.