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

fix(sql lab): Use quote_schema instead of quote method to format schema name #26281

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1433,8 +1433,9 @@ def select_star( # pylint: disable=too-many-arguments,too-many-locals
if show_cols:
fields = cls._get_fields(cols)
quote = engine.dialect.identifier_preparer.quote
quote_schema = engine.dialect.identifier_preparer.quote_schema
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Daydreaming: How I wish Python had this syntax like JS/TS does..

{ quote, quote_schema } = engine.dialect.identifier_preparer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL I learned that quote_schema was a thing. Do we need to use this everywhere we use the quote method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wherever a schema is the input argument, yes. For table names and the like, quote is fine. As far as I could tell this is the only place where a schema name is formatted

if schema:
full_table_name = quote(schema) + "." + quote(table_name)
full_table_name = quote_schema(schema) + "." + quote(table_name)
else:
full_table_name = quote(table_name)

Expand Down
Loading