Skip to content

Parameterized queries with tuples don't work #3090

Closed
@matthias-Q

Description

@matthias-Q

Describe the bug

I was trying to use parameters in a query like:

select * from table_name where id_ in (:ids)

using wr.athena.start_query_execution I provided a list of strings
params={"ids":tuple(["1","1000"])}

This fails with the following error message:
IN value and list items must be the same type or coercible to a common type. Cannot find common type between varchar and array(varchar(4)), all types (without duplicates): [varchar, array(varchar(4))]
There seems to be some conversion going on with the second parameter.

Then I tried to use the paramstyle 'qmark'. The query looked like this:

select * from table_name where id_ in (?,?)

and the query failed with this message
IN value and list items must be the same type or coercible to a common type. Cannot find common type between varchar and integer, all types (without duplicates): [varchar, integer]. Both elements of that list are strings!. For some reason it seems to get converted to integer.

How to Reproduce

*P.S. Please do not attach files as it's considered a security risk. Add code snippets directly in the message body as much as possible.*

Expected behavior

Tuple/Lists into a parameter should not be converted.

Your project

No response

Screenshots

No response

OS

Linux

Python version

3.11

AWS SDK for pandas version

awswrangler>=3.11

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions