feat(sql): Bundle Databricks SQLAlchemy dialect#61
Conversation
also preserve the existing scheme / dialect name from legacy `sqlalchemy-databricks` package as we still reference it in OSS docs
📝 WalkthroughWalkthroughThis PR adds Databricks SQLAlchemy dialect support by updating pyproject.toml with version-gated databricks-sqlalchemy dependencies and a new SQLAlchemy entry point mapping for "databricks.connector". CI workflow audit ignore list is expanded to include CVE-2026-0994 and PYSEC-2024-161. A context manager suppress_third_party_deprecation_warnings was introduced and applied when creating SQLAlchemy engines to suppress a known Databricks deprecation warning. Tests were added to verify both databricks:// and backward-compatible databricks+connector:// URL formats register and load correctly. One existing test (process cleanup on interrupt) was modified to raise KeyboardInterrupt from the process manager's check_processes call instead of simulating interruption via time.sleep. Sequence Diagram(s)sequenceDiagram
participant App as Application / SQLAlchemy
participant EP as EntryPoint Registry
participant DBPkg as databricks.sqlalchemy
participant DB as Databricks
Note over App,EP: Resolve dialect from URL
App->>EP: query "databricks" or "databricks+connector"
EP-->>App: returns factory -> DBPkg:DatabricksDialect
App->>DBPkg: import/load DatabricksDialect
DBPkg-->>App: DatabricksDialect class
App->>DB: connect using DatabricksDialect
DB-->>App: connection established
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
Comment |
|
📦 Python package built successfully!
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61 +/- ##
==========================================
+ Coverage 73.27% 73.28% +0.01%
==========================================
Files 93 93
Lines 5193 5199 +6
Branches 757 757
==========================================
+ Hits 3805 3810 +5
- Misses 1144 1147 +3
+ Partials 244 242 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
🚀 Review App Deployment Started
|
|
This is great! Now I can use my database integration directly :) I do get this warning, though: |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@deepnote_toolkit/sql/sql_execution.py`:
- Around line 443-462: Add an explicit return type to the context manager (e.g.,
-> Iterator[None]) and narrow the warnings.filterwarnings call to only suppress
DeprecationWarning so unrelated warnings aren't swallowed; update the
suppress_third_party_deprecation_warnings signature to include the type import
(Iterator) and change the warnings.filterwarnings(...) call to include
category=DeprecationWarning while keeping the existing message regex and yield
behavior.
In `@tests/unit/test_sql_execution.py`:
- Around line 958-986: In the test functions
test_does_not_suppress_unrelated_warnings and the earlier warning block, update
the calls to warnings.warn to include stacklevel=2 so Ruff B028 is satisfied and
the warning points at the test caller; locate the warnings.warn invocations
inside the with suppress_third_party_deprecation_warnings() context (and the
simulated databricks-sqlalchemy warning) and add the stacklevel=2 kwarg to each
call while leaving the message and category unchanged.
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.