Skip to content

fix(docs): read capability flags from engine specs in database docs generator#39449

Merged
rusackas merged 6 commits into
masterfrom
docs/db-capability-flags-from-engine-specs
May 8, 2026
Merged

fix(docs): read capability flags from engine specs in database docs generator#39449
rusackas merged 6 commits into
masterfrom
docs/db-capability-flags-from-engine-specs

Conversation

@rusackas
Copy link
Copy Markdown
Member

SUMMARY

The database docs generator (docs/scripts/generate-database-docs.mjs) previously hardcoded all capability flags to False defaults and relied on mergeWithExistingDiagnostics to preserve manually-edited values from the committed databases.json. This made it impossible to keep capability flags in sync with the Python engine spec source of truth, and caused flags like supports_catalog, supports_dynamic_schema, query_cancelation, etc. to drift silently.

Changes:

docs/scripts/generate-database-docs.mjs

  • The embedded Python AST extraction path now reads capability flag class attributes (supports_dynamic_schema, supports_catalog, supports_dynamic_catalog, disable_ssh_tunneling, supports_file_upload, allows_joins, allows_subqueries) directly from each engine spec class, with proper inheritance resolution
  • Method overrides are tracked to detect capabilities: cancel_query/get_cancel_query_id/has_implicit_cancelquery_cancelation; estimate_statement_cost/estimate_query_costquery_cost_estimation; impersonate_user/update_impersonation_configuser_impersonation
  • mergeWithExistingDiagnostics now only preserves score, max_score, and time_grains (fields that require Flask context to generate), not capability flags — so regeneration always reflects the current Python source

superset/db_engine_specs/lib.py

  • generate_yaml_docs() now includes supports_dynamic_catalog in its output (was previously missing)
  • Skips "base" specs (no engine value) when they would overwrite a real product spec's data for the same engine_name (fixes PostgresBaseEngineSpec overwriting PostgresEngineSpec flags)

docs/src/data/databases.json

  • Regenerated with corrected capability flags for 80 databases based on Python source
  • Notable corrections: supports_catalog/supports_dynamic_catalog now correct for PostgreSQL, StarRocks, Presto, Trino, Hive, Spark SQL, Snowflake, CockroachDB, and others; query_cancelation now reflects actual method overrides

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — changes affect database docs capability flag display, not visual UI.

TESTING INSTRUCTIONS

  1. Run npm run gen-db-docs from the docs/ directory
  2. Verify the regenerated docs/src/data/databases.json matches the checked-in file (flags should be stable across runs)
  3. Spot-check a few databases in the docs:
    • StarRocks should show catalog: true, dynamic_catalog: true
    • Athena should show catalog: false, dynamic_catalog: false
    • PostgreSQL should show catalog: true, dynamic_catalog: true

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Apr 17, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 17, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b8123f8
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69ef842dfe9ea90007223db0
😎 Deploy Preview https://deploy-preview-39449--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.47%. Comparing base (4c4905f) to head (b8123f8).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
superset/db_engine_specs/lib.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39449      +/-   ##
==========================================
- Coverage   64.48%   64.47%   -0.01%     
==========================================
  Files        2566     2566              
  Lines      133926   133929       +3     
  Branches    31096    31097       +1     
==========================================
  Hits        86357    86357              
- Misses      46074    46077       +3     
  Partials     1495     1495              
Flag Coverage Δ
hive 39.76% <0.00%> (-0.01%) ⬇️
mysql 60.21% <0.00%> (-0.01%) ⬇️
postgres 60.29% <0.00%> (-0.01%) ⬇️
presto 41.54% <0.00%> (-0.01%) ⬇️
python 61.86% <0.00%> (-0.01%) ⬇️
sqlite 59.93% <0.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 Sentry.
📢 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.

rusackas pushed a commit that referenced this pull request Apr 17, 2026
The StarRocks catalog flag fix (supports_catalog, supports_dynamic_catalog)
is now handled by the separate generator fix PR (#39449), which regenerates
databases.json from Python engine spec class attributes. Removing the manual
edit here avoids a merge conflict and keeps the source of truth in the generator.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rusackas rusackas force-pushed the docs/db-capability-flags-from-engine-specs branch from ff8724e to 12d6b2f Compare April 18, 2026 00:10
@rusackas rusackas marked this pull request as ready for review April 19, 2026 19:28
@dosubot dosubot Bot added data:connect Namespace | Anything related to db connections / integrations doc:user User / Superset documentation labels Apr 19, 2026
@rusackas rusackas requested a review from Copilot April 19, 2026 19:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the database documentation generation pipeline so capability flags (catalog/dynamic catalog, dynamic schema, query cancellation, etc.) are derived from the Python engine spec implementations (including inheritance), reducing drift between docs and the engine spec source of truth.

Changes:

  • Extend generate_yaml_docs() to emit supports_dynamic_catalog and avoid base-spec overwrite when engine_name collides.
  • Enhance the docs generator fallback AST extraction to resolve capability flags/method-based capabilities with inheritance, and stop preserving capability flags from the existing databases.json.
  • Regenerate docs/src/data/databases.json with updated capability flags.

Reviewed changes

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

File Description
superset/db_engine_specs/lib.py Prevents base specs from overwriting product spec docs and adds supports_dynamic_catalog to YAML docs output.
docs/scripts/generate-database-docs.mjs Improves fallback extraction to compute capability flags from engine specs (attrs + method overrides) and limits merge-preservation to runtime-only diagnostics.
docs/src/data/databases.json Regenerated output reflecting updated capabilities from engine specs.

Comment thread docs/scripts/generate-database-docs.mjs Outdated
Comment thread docs/scripts/generate-database-docs.mjs
Comment thread docs/scripts/generate-database-docs.mjs Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 19, 2026

Code Review Agent Run #a31bc0

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 12d6b2f..12d6b2f
    • docs/scripts/generate-database-docs.mjs
    • superset/db_engine_specs/lib.py
  • Files skipped - 1
    • docs/src/data/databases.json - Reason: Filter setting
  • 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

Comment thread docs/scripts/generate-database-docs.mjs
Comment thread docs/scripts/generate-database-docs.mjs Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 23, 2026

Code Review Agent Run #3cbd95

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 12d6b2f..1800a72
    • docs/scripts/generate-database-docs.mjs
  • Files skipped - 0
  • Tools
    • 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 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

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Code Review Agent Run #bdcab5

Actionable Suggestions - 1
  • docs/scripts/generate-database-docs.mjs - 1
Review Details
  • Files reviewed - 1 · Commit Range: 1800a72..7cd1baf
    • docs/scripts/generate-database-docs.mjs
  • Files skipped - 0
  • Tools
    • 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 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

Comment thread docs/scripts/generate-database-docs.mjs
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 23, 2026

Code Review Agent Run #014bea

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7cd1baf..693bfaf
    • docs/scripts/generate-database-docs.mjs
  • Files skipped - 0
  • Tools
    • 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 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

Superset Dev and others added 6 commits April 27, 2026 08:43
…enerator

Update the database docs generator to extract capability flag values
directly from Python engine spec class attributes (supports_catalog,
supports_dynamic_schema, etc.) and method overrides (cancel_query,
estimate_statement_cost, impersonate_user, has_implicit_cancel, etc.)
using AST parsing in the fallback path.

Previously the generator hardcoded False for all capability flags and
relied on mergeWithExistingDiagnostics to preserve manual edits from
the existing databases.json. This made it impossible to keep flags
in sync with the Python source.

Changes:
- Fallback AST path now extracts cap flags via AST with proper
  inheritance resolution (mirrors lib.py has_custom_method logic)
- mergeWithExistingDiagnostics now only preserves score/max_score/
  time_grains (Flask-context-only fields), not capability flags
- lib.py generate_yaml_docs now includes supports_dynamic_catalog
  in its output, and skips base specs that would overwrite a real
  product spec's flags for the same engine_name
- Regenerated databases.json with corrected flag values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Python attribute lookup picks the first base that defines the attr; the
previous left-to-right update() order caused later bases to override
earlier ones, contradicting MRO. Reversing the iteration makes the
leftmost base the final writer, which matches Python semantics for the
common single-chain hierarchies in db_engine_specs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Cap attrs assigned via expressions (e.g. DruidEngineSpec.allows_joins =
is_feature_enabled("DRUID_JOINS")) can't be statically evaluated, so
they previously silently fell back to the BaseEngineSpec default —
causing generated docs to disagree with runtime behavior.

Now the Python extractor tracks unresolvable assignments per class,
propagates them through the MRO walk, and emits an
_unresolved_cap_fields marker on the database entry. The JS layer
uses that marker to prefer the value from the previously-generated
databases.json (which was produced with Flask context and reflects
real runtime values) and strips the marker before writing output.

Verified against druid.py: extraction correctly emits
"_unresolved_cap_fields": ["joins"], and the existing JSON's
"joins": false is preserved rather than overwritten with the base
default of true.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
diagnose() in lib.py only counts cancel_query being overridden OR
has_implicit_cancel() returning True (equivalent, statically, to
overriding has_implicit_cancel since the base returns False). The
extractor additionally counted get_cancel_query_id, which could mark
cancellation as supported even when cancel_query wasn't overridden.
Removed get_cancel_query_id from CAP_METHODS and the query_cancelation
check so the generated docs match diagnose().

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
diagnose() in lib.py calls spec.has_implicit_cancel() and uses the
return value; the extractor was treating any override as cancel
support, regardless of what it returns. An override that explicitly
returns False (e.g. ImpalaEngineSpec) should NOT enable
query_cancelation — only a cancel_query override should, per
has_custom_method(spec, "cancel_query") or spec.has_implicit_cancel().

Added static_return_bool() to statically resolve simple "return
<bool>" methods. has_implicit_cancel overrides that explicitly
return False are now excluded from direct_methods; True /
unresolvable / complex bodies still count (conservative). For current
specs the outcome is unchanged (Impala/Hive have cancel_query
overrides; Presto/Hive return True), but the heuristic now matches
diagnose() exactly and won't misclassify future specs that override
has_implicit_cancel to False without a cancel_query override.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
A later bare string literal in a function body is not a docstring and
should count as non-trivial logic. Track whether the docstring has been
skipped so subsequent string-constant expression statements fall through
to the conservative 'other_logic' branch.
@rusackas rusackas force-pushed the docs/db-capability-flags-from-engine-specs branch from 693bfaf to b8123f8 Compare April 27, 2026 15:43
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 27, 2026

Code Review Agent Run #95cb7a

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • docs/scripts/generate-database-docs.mjs - 1
Review Details
  • Files reviewed - 2 · Commit Range: 3c19df8..b8123f8
    • docs/scripts/generate-database-docs.mjs
    • superset/db_engine_specs/lib.py
  • Files skipped - 1
    • docs/src/data/databases.json - Reason: Filter setting
  • 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

@rusackas rusackas merged commit 5bde867 into master May 8, 2026
68 checks passed
@rusackas rusackas deleted the docs/db-capability-flags-from-engine-specs branch May 8, 2026 16:13
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
…enerator (apache#39449)

Co-authored-by: Superset Dev <dev@superset.apache.org>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:connect Namespace | Anything related to db connections / integrations doc:user User / Superset documentation doc Namespace | Anything related to documentation size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants