Skip to content

fix(databricks): restore the dynamic connection form - #45911

Open
Vitor-Avila wants to merge 3 commits into
apache:masterfrom
Vitor-Avila:fix/databricks-dynamic-form
Open

Vitor-Avila wants to merge 3 commits into
apache:masterfrom
Vitor-Avila:fix/databricks-dynamic-form

Conversation

@Vitor-Avila

Copy link
Copy Markdown
Contributor

SUMMARY

The official databricks-sqlalchemy dialect reports its driver as databricks, but Superset advertises databricks-sql-python. The available-databases API only includes dynamic-form parameters when the spec's default driver is installed, so this mismatch omits the form schema.

Update the Python connector's default driver and driver mapping to databricks. This PR is limited to restoring the connection form; legacy-driver removal and connection migration are follow-up work.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: with the official dialect installed, the Databricks connection form can appear blank because its parameters are missing from the API response.

After: the registered driver matches the spec, allowing the API to include the dynamic-form parameters.

TESTING INSTRUCTIONS

  1. Install Superset's Databricks extra with databricks-sqlalchemy 2.x.
  2. Open Settings → Database Connections → + Database, then select Databricks.
  3. Verify that the connection fields render. The Databricks entry from /api/v1/database/available/ should include default_driver: "databricks" and parameters.

Local validation: pre-commit passed; 61 focused Databricks, multi-cloud, and engine-discovery unit tests passed. OAuth and installed-dialect SQL-rendering tests were excluded because unrelated failures were also reproduced on the unchanged base. Live UI validation was not performed because the local server was not running.

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

@netlify

netlify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit e7bc151
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae57ab7cde00af93f14063f
😎 Deploy Preview https://deploy-preview-45911--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.

engine_name = "Databricks"
default_driver = "databricks-sql-python"
drivers = {"databricks-sql-python": "Databricks SQL Python"}
default_driver = "databricks"

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.

Suggestion: If only a legacy Databricks driver is installed, the API omits this spec’s parameters but still selects this default; URI mode then uses the unavailable Python dialect and connections fail.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/db_engine_specs/databricks.py
**Line:** 745:745
**Comment:**
	*Api Mismatch: If only a legacy Databricks driver is installed, the API omits this spec’s parameters but still selects this default; URI mode then uses the unavailable Python dialect and connections fail.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟡  Medium Risk

  • The PR needs attention before merging.
  • With only a legacy Databricks driver installed, the API may select the new default while omitting its connection parameters, leading to failed connections.

Assessed commit: 4588aa07f2f9

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.76%. Comparing base (a846d75) to head (e7bc151).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #45911       +/-   ##
===========================================
+ Coverage   65.62%   84.76%   +19.13%     
===========================================
  Files        3071     3071               
  Lines      206037   206037               
  Branches    48506    48506               
===========================================
+ Hits       135211   174637    +39426     
+ Misses      67735    28101    -39634     
- Partials     3091     3299      +208     
Flag Coverage Δ
hive 34.49% <100.00%> (ø)
mysql 52.60% <100.00%> (ø)
postgres 52.61% <100.00%> (?)
presto 36.22% <100.00%> (ø)
python 87.76% <100.00%> (+34.98%) ⬆️
sqlite 52.37% <100.00%> (ø)
unit 82.54% <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.

@mikebridge mikebridge 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.

Thanks Vitor, this looks right to me. build_sqlalchemy_uri still writes a bare databricks:// URI, so stored connection strings don't change, and existing connections now resolve to this spec by exact driver match instead of through the fallback.

A few small things you might fold in before merge:

  • A test for the fix itself. Nothing pins the original bug: a unit test where the available drivers include databricks for the databricks backend, checking that the Databricks entry comes back with default_driver == "databricks" and non-empty parameters, would stop the mismatch from returning.
  • tests/unit_tests/db_engine_specs/test_databricks.py:1410 asserts get_engine_spec("databricks", "databricks-sql-python") under the "exact driver matches" comment. After this change that string only resolves through the fallback, so it still passes but no longer tests an exact match. Switching it to "databricks" keeps the intent; the old string could move up to the fallback assertion, since legacy URIs may still carry it.
  • docs/src/data/databases.json still lists default_driver: "databricks-sql-python". Regenerating it (leaving the 6.1.0 versioned copy alone) keeps the docs in step; fine as a follow-up.

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Oct 31, 2026

This branch has not been deployed

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

Labels

doc Namespace | Anything related to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants