Skip to content

chore: sql/parse cleanup#33515

Merged
betodealmeida merged 1 commit intomasterfrom
sql-parse-cleanup
May 27, 2025
Merged

chore: sql/parse cleanup#33515
betodealmeida merged 1 commit intomasterfrom
sql-parse-cleanup

Conversation

@betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented May 19, 2025

SUMMARY

This PR removes the _sql attribute from SQLStatement and KustoKQLStatement, keeping only the AST in the class. This is important because in #33473 we modify the AST inplace, which would require calling format() to keep _sql in sync. Since the attribute is no longer used in any meaningful way it's better to just get rid of it.

Part of #26786, stacked on #33457, #33456, and #33473.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

I've completed my review and didn't find any issues.

Files scanned
File Path Reviewed
superset/sql_lab.py
superset/sql_parse.py
superset/sql/parse.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@michael-s-molina
Copy link
Member

Thanks for creating a feature branch for this @betodealmeida. It will help with testing.

return SQLStatement(ast=self._parsed.copy(), engine=self.engine)

optimized = pushdown_predicates(self._parsed, dialect=self._dialect)
sql = optimized.sql(dialect=self._dialect)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we're removing this? Is it redundant?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is redundant. Before, to create a new statement we had to pass the SQL (a string) and the AST, so here we were generating the SQL. Now we just pass the AST directly.

Copy link
Contributor

@Vitor-Avila Vitor-Avila left a comment

Choose a reason for hiding this comment

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

lgtm! did some manual testing as well and didn't notice any issues

Base automatically changed from set-limit to master May 27, 2025 19:20
@betodealmeida betodealmeida merged commit 1393f7d into master May 27, 2025
49 of 50 checks passed
@betodealmeida betodealmeida deleted the sql-parse-cleanup branch May 27, 2025 20:42
LevisNgigi pushed a commit to LevisNgigi/superset that referenced this pull request Jun 18, 2025
@github-actions github-actions bot added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 6.0.0 First shipped in 6.0.0 labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/M 🚢 6.0.0 First shipped in 6.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants