-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Trino oauth support #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add support for using OAuth Bearer tokens when connecting to Trino databases. When TRINO_OAUTH_TOKEN environment variable is set, the connection will use Bearer authentication instead of basic auth. This enables federated authentication flows where OAuth tokens are managed externally and passed to the SQL execution layer via environment variables. Co-Authored-By: jakub@deepnote.com <jakub.jurovych@gmail.com>
The trino library provides JWTAuthentication for Bearer token auth, not BearerAuthentication. This fixes a runtime error that would occur when trying to use OAuth tokens with Trino connections. Co-Authored-By: jakub@deepnote.com <jakub.jurovych@gmail.com>
📝 WalkthroughWalkthroughThe change adds Trino OAuth authentication support to SQL connection initialization. When a Trino database connection is detected (URL scheme Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Comment |
|
📦 Python package built successfully!
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
- Coverage 76.60% 76.45% -0.16%
==========================================
Files 99 99
Lines 5476 5491 +15
Branches 748 750 +2
==========================================
+ Hits 4195 4198 +3
- Misses 1281 1293 +12 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
deepnote_toolkit/sql/sql_execution.py(2 hunks)
🧰 Additional context used
🪛 Ruff (0.14.2)
deepnote_toolkit/sql/sql_execution.py
466-466: Missing return type annotation for private function _build_params_for_trino_oauth
(ANN202)
471-471: Create your own exception
(TRY002)
471-471: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (1)
deepnote_toolkit/sql/sql_execution.py (1)
110-114: Trino dependency confirmed—code approved.Trino is declared in main dependencies at line 95 of
pyproject.tomlas"trino[sqlalchemy]>=0.327.0,<=0.330.0". The OAuth detection logic at lines 110-114 correctly mirrors the BigQuery pattern, and the helper function includes proper defensive error handling. The redundant token check (at lines 110 and 470) is benign.
|
🚀 Review App Deployment Started
|
Summary by CodeRabbit