Skip to content

fix(chart): preserve SQL_QUERY_MUTATOR line comments structure#41215

Open
Vitor-Avila wants to merge 1 commit into
masterfrom
fix/query-comments
Open

fix(chart): preserve SQL_QUERY_MUTATOR line comments structure#41215
Vitor-Avila wants to merge 1 commit into
masterfrom
fix/query-comments

Conversation

@Vitor-Avila

Copy link
Copy Markdown
Contributor

SUMMARY

A common use case for SQL_QUERY_MUTATOR is to add metadata comments to a query. For example, a chart query could be:

-- chart_id: 1
-- dataset_id: 1
SELECT COUNT(*) FROM cleaned_sales_data;

We were re-parsing the query after the mutator with .format(), which would change this query to:

/* chart_id: 1 */ /* dataset_id: 1 */
SELECT COUNT(*) FROM cleaned_sales_data;

This breaks existing logic built externally to parse logs. Additionally, Superset should change queries as little as possible.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No UI changes.

TESTING INSTRUCTIONS

  1. Create a virtual dataset with multiple top-level comments like shared above (or configure comments via SQL_QUERY_MUTATOR.
  2. Execute a query and confirm it doesn't change the comment structure.

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

@bito-code-review

bito-code-review Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2d6fef

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: f8537d1..f8537d1
    • superset/models/core.py
    • tests/unit_tests/models/core_test.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.36%. Comparing base (3eae8cd) to head (f8537d1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #41215   +/-   ##
=======================================
  Coverage   64.36%   64.36%           
=======================================
  Files        2651     2651           
  Lines      144812   144813    +1     
  Branches    33417    33417           
=======================================
+ Hits        93203    93204    +1     
  Misses      49938    49938           
  Partials     1671     1671           
Flag Coverage Δ
hive 39.32% <0.00%> (-0.01%) ⬇️
mysql 58.05% <100.00%> (+<0.01%) ⬆️
postgres 58.11% <100.00%> (+<0.01%) ⬆️
presto 40.90% <100.00%> (+<0.01%) ⬆️
python 59.56% <100.00%> (+<0.01%) ⬆️
sqlite 57.77% <100.00%> (+<0.01%) ⬆️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant