Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1871392: Quoting changes for column names starting with _ #565

Closed
jochenott opened this issue Jan 2, 2025 · 1 comment · Fixed by #569
Closed

SNOW-1871392: Quoting changes for column names starting with _ #565

jochenott opened this issue Jan 2, 2025 · 1 comment · Fixed by #569
Labels
bug Something isn't working status-triage_done Initial triage done, will be further handled by the driver team

Comments

@jochenott
Copy link

jochenott commented Jan 2, 2025

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using? 3.12

  2. What operating system and processor architecture are you using? osx-arm64

  3. What are the component versions in the environment (pip freeze)? Main component: snowflake-sqlalchemy 1.7.2

  4. What did you do?
    We have sqlalchemy code that uses constructs like some_expression.label("_column0"), i.e. it selects columns "as" an identifier that starts with an underscore.

  5. What did you expect to see?
    So far (with smaller versions of snowflake-sqlalchemy), no quoting would be used when compiling these identifier names, effectively upper-casing these column names. This is what I expect to see.
    Now, as a result of mraba/underscore_column_id: use _ as column identifier #538, quoting is used. No upper-casing is done and the effective column names used by snowflake are no longer as expected, since snowflake sees a quoted name now and no longer does implicit uppercase conversion.

This breaks many of our queries that worked just fine until 1.7.1 and is a blocker to upgrade. I don't see any clear workaround, I think #538 should be reverted.

To reproduce:

from snowflake.sqlalchemy.snowdialect import SnowflakeDialect
from sqlalchemy.sql.compiler import SQLCompiler
import sqlalchemy as sa

dialect = SnowflakeDialect()

stmt = sa.Column("_a")
print(str(SQLCompiler(dialect, stmt)))

For snowflake-sqlalchemy 1.7.1, the output is:

_a

For snowflake-sqlalchemy 1.7.2, the output is:

"_a"
@jochenott jochenott added bug Something isn't working needs triage labels Jan 2, 2025
@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage_done Initial triage done, will be further handled by the driver team and removed needs triage labels Jan 3, 2025
@sfc-gh-dszmolka
Copy link
Contributor

hi - thanks for raising this with us. We'll take a look.

@sfc-gh-dszmolka sfc-gh-dszmolka changed the title Quoting changes for column names starting with _ SNOW-1871392: Quoting changes for column names starting with _ Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
2 participants