Open michaelkwagner opened 1 year ago
Check out https://github.com/ibis-project/ibis/pull/5741 for a possible workaround.
hi folks - apologies for leaving this unanswered for so long; we're changing that going forward. for now, possibly
might be all originating from the same gap in snowflake-sqlalchemy. At this time, I cannot promise any timeline for taking care of this, but rest assured we're aware of the issue and i'll keep this thread posted.
I saw what I believe is a flavor of this (cursor doesn't support parameter binding with quoted_name
) when using an all uppercase schema name (without quotes) in inspector.reflect_table
.
Traceback (most recent call last):
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
File "../.venv/lib/python3.11/site-packages/snowflake/connector/cursor.py", line 1016, in execute
kwargs["binding_params"] = self._connection._process_params_qmarks(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/connection.py", line 1480, in _process_params_qmarks
snowflake_type, snowflake_binding = get_type_and_binding(v)
^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/connection.py", line 1452, in _get_snowflake_type_and_binding
self.converter.to_snowflake_bindings(snowflake_type, v),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/converter.py", line 367, in to_snowflake_bindings
return getattr(self, f"_{type_name}_to_snowflake_bindings")(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/converter.py", line 660, in __getattr__
raise ProgrammingError(
snowflake.connector.errors.ProgrammingError: 255001: 255001: Binding data in type (quoted_name) is not supported.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 774, in reflect_table
for col_d in self.get_columns(
^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 497, in get_columns
col_defs = self.dialect.get_columns(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/sqlalchemy/snowdialect.py", line 668, in get_columns
schema_columns = self._get_schema_columns(connection, schema, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 2, in _get_schema_columns
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 55, in cache
ret = fn(self, con, *args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/sqlalchemy/snowdialect.py", line 481, in _get_schema_columns
result = connection.execute(
^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1380, in execute
return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
self._handle_dbapi_exception(
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
util.raise_(
File "../.venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "../.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
File "../.venv/lib/python3.11/site-packages/snowflake/connector/cursor.py", line 1016, in execute
kwargs["binding_params"] = self._connection._process_params_qmarks(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/connection.py", line 1480, in _process_params_qmarks
snowflake_type, snowflake_binding = get_type_and_binding(v)
^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/connection.py", line 1452, in _get_snowflake_type_and_binding
self.converter.to_snowflake_bindings(snowflake_type, v),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/converter.py", line 367, in to_snowflake_bindings
return getattr(self, f"_{type_name}_to_snowflake_bindings")(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../.venv/lib/python3.11/site-packages/snowflake/connector/converter.py", line 660, in __getattr__
raise ProgrammingError(
sqlalchemy.exc.ProgrammingError: (snowflake.connector.errors.ProgrammingError) 255001: 255001: Binding data in type (quoted_name) is not supported.
[SQL:
SELECT /* sqlalchemy:_get_schema_columns */
ic.table_name,
ic.column_name,
ic.data_type,
ic.character_maximum_length,
ic.numeric_precision,
ic.numeric_scale,
ic.is_nullable,
ic.column_default,
ic.is_identity,
ic.comment,
ic.identity_start,
ic.identity_increment
FROM information_schema.columns ic
WHERE ic.table_schema=?
ORDER BY ic.ordinal_position]
[parameters: ('PUBLIC',)]
(Background on this error at: https://sqlalche.me/e/14/f405)
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using?
Python 3.9.9
What operating system and processor architecture are you using?
macOS-11.5.2-x86_64-i386-64bit
What are the component versions in the environment (
pip freeze
)?Relevant modules:
metadata.reflect()
works as expected for uppercase / case insensitive. However, fails for lower and mixed case / case sensitive. Would expectmetadata.reflect()
to work regardless of casing / case sensitivity.Also, looked for a means to indicate case sensitivity, did not find one.