You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Hi @matthias-Q, You are using a tuple (("1", "1000")) for the IN clause, but Athena expects the list values to have a consistent type. When you provide a tuple of strings, Athena interprets it as an array of varchar, which causes the type mismatch.
To resolve this, ensure that all values in the list or tuple are of the same type, either as strings or as integers, depending on your table's column data type.
params = {"ids": ["1", "1000"]} # Make sure all values are strings
If the id_ column is of integer type, you can try passing the integers instead:
params = {"ids": [1, 1000]} # Use integers if the column is of type integer
Describe the bug
I was trying to use parameters in a query like:
using
wr.athena.start_query_execution
I provided a list of stringsparams={"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:
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
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
The text was updated successfully, but these errors were encountered: