Skip to content

fix(charts): support saved_query datasource in chart create/update - #43499

Merged
sadpandajoe merged 12 commits into
masterfrom
fix/issue-29697-saved-query-datasource-name
Nov 20, 2026
Merged

sadpandajoe merged 12 commits into
masterfrom
fix/issue-29697-saved-query-datasource-name

Conversation

@rusackas

@rusackas rusackas commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

SUMMARY

Creating (or updating) a chart with datasource_type: saved_query raised a fatal 'SavedQuery' object has no attribute 'name' error. CreateChartCommand/UpdateChartCommand.validate() read datasource.name to populate datasource_name, and every other datasource type (SqlaTable, Query, SemanticView) exposes a name, but SavedQuery only had a label column. This adds a name property to SavedQuery that returns label, so it behaves like the rest of the Datasource union instead of special-casing the command layer.

saved_query is now a fully persistable chart datasource type: the ck_chart_datasource CHECK constraint on slices.datasource_type is extended (migration dfa683969f48) to allow it alongside table/semantic_view, matching what validate_chart_datasource_type already accepted.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A (backend-only fix, no UI change)

TESTING INSTRUCTIONS

  • Added a regression test that pins the bug: tests/unit_tests/commands/chart/test_access_checks.py::test_create_chart_command_supports_saved_query_datasource builds a real SavedQuery (not a mock) and asserts CreateChartCommand.validate() no longer raises AttributeError and correctly derives datasource_name from label.
  • tests/integration_tests/charts/api_tests.py::TestChartApi::test_create_chart_from_saved_query posts a real chart-create request end to end and asserts a 201.
  • Manually: POST /api/v1/chart/ with datasource_type: "saved_query" and a valid datasource_id should now create the chart instead of returning a 500.
  • pytest tests/unit_tests/commands/chart/test_access_checks.py tests/unit_tests/models/sql_lab_test.py

ADDITIONAL INFORMATION

@bito-code-review

bito-code-review Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #b8bc04

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

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the api:charts Related to the REST endpoints of charts label Aug 25, 2026
@rusackas
rusackas requested review from betodealmeida and sha174n and a lite review from Copilot and removed request for betodealmeida August 25, 2026 04:36
Comment thread superset/models/sql_lab.py Resolved
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The label property in SavedQuery is nullable, but the new name property is annotated to return a str, which can lead to runtime errors or None values being stored where a string is expected. To resolve this, you should provide a non-null fallback (e.g., an empty string) and update the return type annotation to reflect that it may be optional if label is missing.

Here is the corrected implementation for superset/models/sql_lab.py:

    @property
    def name(self) -> str:
        """
        Expose ``label`` as ``name`` so callers that treat a ``SavedQuery`` as
        a generic datasource (e.g. chart create/update commands) can rely on
        a uniform ``name`` attribute across all datasource types.
        """
        return self.label or ""

There are no other comments on this PR to address. Would you like me to check for any other potential issues in the codebase?

superset/models/sql_lab.py

@property
    def name(self) -> str:
        """
        Expose ``label`` as ``name`` so callers that treat a ``SavedQuery`` as
        a generic datasource (e.g. chart create/update commands) can rely on
        a uniform ``name`` attribute across all datasource types.
        """
        return self.label or ""

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes saved-query datasource support for chart creation and updates by exposing SavedQuery.label as name.

Changes:

  • Adds SavedQuery.name.
  • Adds chart validation regression coverage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Review summary
tests/unit_tests/commands/chart/test_access_checks.py Adds validation coverage, but not full access or persistence coverage.
superset/models/sql_lab.py Adds name, but saved-query access checks and slice persistence still require missing permission/data attributes.
Suppressed comments (1)

tests/unit_tests/commands/chart/test_access_checks.py:122

  • This regression test patches out security_manager.raise_for_access, so it only proves that name exists and cannot detect the subsequent access/persistence failures described above. It also does not exercise the advertised UpdateChartCommand path. Add coverage for both command paths that validates the selected saved-query access contract and the chart persistence hook.
    with patch(
        "superset.commands.chart.create.get_datasource_by_id",
        return_value=saved_query,
    ):
        with patch("superset.commands.chart.create.security_manager.raise_for_access"):
            with patch(
                "superset.commands.chart.create.populate_subjects",
                return_value=[],
            ):

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread superset/models/sql_lab.py Resolved
Comment thread superset/models/sql_lab.py Resolved
@codecov

codecov Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.15044% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.26%. Comparing base (f357ec3) to head (f13300f).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
superset/models/sql_lab.py 84.61% 5 Missing and 1 partial ⚠️
superset/models/slice.py 75.00% 1 Missing and 1 partial ⚠️
superset/security/manager.py 95.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43499      +/-   ##
==========================================
- Coverage   85.66%   85.26%   -0.41%     
==========================================
  Files        3111     3093      -18     
  Lines      214938   212816    -2122     
  Branches    50908    49844    -1064     
==========================================
- Hits       184136   181466    -2670     
- Misses      27381    27932     +551     
+ Partials     3421     3418       -3     
Flag Coverage Δ
hive 33.99% <27.43%> (-0.02%) ⬇️
mysql 51.67% <64.60%> (+<0.01%) ⬆️
postgres 51.70% <64.60%> (?)
presto 35.68% <27.43%> (-0.02%) ⬇️
python 88.30% <90.26%> (+0.01%) ⬆️
sqlite 51.38% <63.71%> (+<0.01%) ⬆️
unit 83.58% <87.61%> (+<0.01%) ⬆️

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.

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Aug 25, 2026
@bito-code-review

bito-code-review Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #100eb3

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/models/sql_lab.py - 1
    • CWE-20: Schema perm inconsistent API · Line 577-577
      The `schema_perm` property uses direct string formatting `f"{self.database.database_name}.{self.schema}"` instead of calling `security_manager.get_schema_perm()`, which deviates from the pattern used by `SqlaTable.get_schema_perm()` (line 1677 of sqla/models.py) and `Query.schema_perm`. This also skips the edge-case handling in `get_schema_perm()` that returns `None` for empty schemas instead of producing malformed strings like `[db].`.
Review Details
  • Files reviewed - 2 · Commit Range: a0fe61f..2e8931a
    • superset/models/sql_lab.py
    • tests/unit_tests/commands/chart/test_access_checks.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/models/sql_lab.py Resolved
@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit f13300f
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aff8639d85d8daec21b1ccf
😎 Deploy Preview https://deploy-preview-43499--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #d62867

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset/daos/datasource.py - 1
    • Misleading not-found error · Line 92-102
      Raising `DatasourceNotFound` (404 'Datasource does not exist') for a SavedQuery that exists but lacks a database is misleading — the datasource isn't missing, it's invalid. The comment asks for a 'controlled validation error'; `DatasourceValueIsIncorrect` (422, already imported) fits better and avoids a false 404 via `get_datasource_by_id` → `DatasourceNotFoundValidationError`.
  • tests/unit_tests/commands/chart/test_access_checks.py - 1
    • Misleading test coverage · Line 143-166
      The test name says it rejects a saved query without a database, but it patches `get_datasource_by_id` to raise `DatasourceNotFoundValidationError` directly — no SavedQuery with `db_id=None` is created and the new DAO guard is never exercised. It only verifies `validate()` propagates the error to `ChartInvalidError`. Patch the DAO path or rename the test.
Review Details
  • Files reviewed - 3 · Commit Range: 2e8931a..b20876c
    • superset/daos/datasource.py
    • tests/unit_tests/commands/chart/test_access_checks.py
    • tests/unit_tests/datasource/dao_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas force-pushed the fix/issue-29697-saved-query-datasource-name branch from b20876c to decf0eb Compare September 23, 2026 14:09
@rusackas

Copy link
Copy Markdown
Member Author

Looks like #43500 solved the underlying #29697 crash the other way, rejecting saved_query/query as chart datasources instead of making them work, and #44416 locked that in with an explicit TABLE/SEMANTIC_VIEW allowlist. That's why validate_chart_datasource_type now rejects saved_query on master, and this PR's own regression test fails after a rebase. Still worth landing, or close this in favor of #43500?

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review Agent Run #77baf9

Actionable Suggestions - 1
  • superset/models/sql_lab.py - 1
Additional Suggestions - 1
  • superset/models/sql_lab.py - 1
    • unguarded database deref · Line 613-613
      `perm`/`schema_perm`/`catalog_perm` dereference `self.database.database_name` unguarded, while the sibling `data` property guards `if self.database:`. The DAO guard (datasource.py:92) checks `db_id is None`, not the relationship being loaded, so a saved query with an orphaned `db_id` (FK set, `database` None) passes the guard and crashes here. Consider guarding like `data`.
Review Details
  • Files reviewed - 4 · Commit Range: f6e8aef..decf0eb
    • superset/daos/datasource.py
    • superset/models/sql_lab.py
    • tests/unit_tests/commands/chart/test_access_checks.py
    • tests/unit_tests/datasource/dao_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/models/sql_lab.py Resolved
@bito-code-review

bito-code-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #03285a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: decf0eb..7188d5f
    • superset/models/sql_lab.py
    • tests/unit_tests/commands/chart/test_access_checks.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review Agent Run #b02e31

Actionable Suggestions - 1
  • superset/commands/chart/utils.py - 1
Review Details
  • Files reviewed - 1 · Commit Range: 7188d5f..3ea862d
    • superset/commands/chart/utils.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/commands/chart/utils.py Resolved
@bito-code-review

bito-code-review Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #7973e4

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 3ea862d..761be17
    • tests/unit_tests/commands/chart/create_test.py
    • tests/unit_tests/commands/chart/update_test.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the risk:db-migration PRs that require a DB migration label Sep 29, 2026

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review Agent Run #4e1e9f

Actionable Suggestions - 1
  • tests/integration_tests/charts/semantic_save_tests.py - 1
Review Details
  • Files reviewed - 3 · Commit Range: 761be17..760c2a6
    • superset/migrations/versions/2026-09-29_00-00_dfa683969f48_allow_saved_query_chart_datasource.py
    • tests/integration_tests/charts/api_tests.py
    • tests/integration_tests/charts/semantic_save_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

bito-code-review Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #50bb06

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 760c2a6..24e192d
    • tests/integration_tests/charts/semantic_save_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 30, 2026
@rusackas
rusackas force-pushed the fix/issue-29697-saved-query-datasource-name branch from 24e192d to 9443417 Compare September 30, 2026 23:54
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 22, 2026
Comment thread superset/commands/chart/utils.py Resolved
Comment thread superset/commands/database/update.py Resolved
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@rusackas the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@rusackas the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@rusackas
rusackas force-pushed the fix/issue-29697-saved-query-datasource-name branch from cb86146 to 478b840 Compare October 28, 2026 22:11
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 31, 2026
@rusackas
rusackas force-pushed the fix/issue-29697-saved-query-datasource-name branch from 478b840 to 0053e08 Compare October 31, 2026 03:44
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 31, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@rusackas the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

Comment thread superset/models/slice.py Resolved
Comment thread superset/security/manager.py Resolved
rusackas and others added 7 commits November 4, 2026 19:43
Rebased squash of the saved_query chart datasource work onto current master.

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Require a real database/schema grant (not saved-query editorship) when binding a
chart to a saved query, fall back to the default catalog for catalog_perm,
resync dependent charts on catalog changes, and limit database-rename resync to
saved queries that have charts, resolving the default catalog once.

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…asources

Only pass allow_editorship=False when binding a chart to a saved query;
tables and semantic views go through the same raise_for_access(datasource=...)
call as before. The extra kwarg broke semantic_save_tests' call assertion,
and because that test aborted before cleanup, its leftover semantic_view
chart cascaded into the reports, dashboards export, and change_records
failures later in the integration run.

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…head

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rusackas
rusackas force-pushed the fix/issue-29697-saved-query-datasource-name branch from 0053e08 to 357e947 Compare November 5, 2026 03:44

@sha174n sha174n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

rusackas and others added 4 commits November 13, 2026 15:38
…og resync

Drive CreateChartCommand and UpdateChartCommand with the ownership check
unpatched, so dropping the call from either command fails a test. Run the
real _update_catalog_attribute against a persisted saved-query chart and
assert its catalog_perm and schema_perm follow the new catalog.

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…onship

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…count

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@rusackas the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@rusackas the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@sadpandajoe

Copy link
Copy Markdown
Member

Had claude scan through the code and it didn't see a migration conflict. Going to merge and will monitor in case if there is one and will open a follow-up pr.

@sadpandajoe
sadpandajoe merged commit 47bbaf9 into master Nov 20, 2026
93 of 98 checks passed
@sadpandajoe
sadpandajoe deleted the fix/issue-29697-saved-query-datasource-name branch November 20, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:charts Related to the REST endpoints of charts preset-io risk:db-migration PRs that require a DB migration size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error when creating a chart from a saved_query via API call

4 participants