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
business_uuid=UUID("4363f57d-c9ca-4e63-92c7-3e67786c8a30")
user_uuid=UUID("4363f57d-c9ca-4e63-92c7-3e67786c8a30")
stmt=text(
"SELECT * FROM users WHERE business_uuid = :business_uuid AND user_uuid IN [:user_uuids]"
)
conn.cursor().execute(
stmt,
params={"business_uuid": business_uuid.bytes, "user_uuids": [user_uuid.bytes]},
)
But it is throwing the following error:
.venv/lib/python3.12/site-packages/snowflake/connector/connection.py:1867: in _process_single_param
return _quote(escape(to_snowflake(param)))
.venv/lib/python3.12/site-packages/snowflake/connector/converter.py:483: in to_snowflake
return getattr(self, f"_{type_name}_to_snowflake")(value)
.venv/lib/python3.12/site-packages/snowflake/connector/converter.py:626: in _list_to_snowflake
SnowflakeConverter.quote(v0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = b';\xe7\x0czb\xa8Kd\xad\x87|G\xae\x8b\xfcM'
@staticmethod
def quote(value) -> str:
if isinstance(value, list):
return ",".join(value)
if value is None:
return "NULL"
elif isinstance(value, bool):
return "TRUE" if value else "FALSE"
elif IS_NUMERIC(value):
return str(repr(value))
elif IS_BINARY(value):
# Binary literal syntax
> return "X'{}'".format(value.decode("ascii"))
E UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 1: ordinal not in range(128)
.venv/lib/python3.12/site-packages/snowflake/connector/converter.py:722: UnicodeDecodeError
For the single business param, to_snowflake is called on the value which results in _bytes_to_snowflake and therefore binary_to_snowflake being called on the value.
For in the case of the list, the to_snowflake call isn't called per each list item, and therefore to_snowflake isn't called.
What did you expect to see?
I expect the list of uuid bytes to be converted properly without error.
Can you set logging to DEBUG and collect the logs?
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
converter doesn't properly convert lists of bytes
SNOW-2090775: converter doesn't properly convert lists of bytes
May 6, 2025
jeffsawatzky
added a commit
to jeffsawatzky/snowflake-connector-python
that referenced
this issue
May 6, 2025
hi - thanks for reporting this issue and especially for submitting a possible fix with the PR , too !
I see a support case (01019378) was also raised for the same issue, so I'm now closing this GH issue as a duplicate to allow focus the efforts on one ticket.
Python version
3.12.10
Operating system and processor architecture
macOS-15.4.1-x86_64-i386-64bit
Installed packages
What did you do?
I am trying to run a query like this:
But it is throwing the following error:
For the single business param,
to_snowflake
is called on the value which results in_bytes_to_snowflake
and thereforebinary_to_snowflake
being called on the value.For in the case of the list, the
to_snowflake
call isn't called per each list item, and thereforeto_snowflake
isn't called.What did you expect to see?
I expect the list of uuid bytes to be converted properly without error.
Can you set logging to DEBUG and collect the logs?
The text was updated successfully, but these errors were encountered: