Skip to content

[trino] Fix the basic Trino connector and restrict custom connectors - #4393

Merged
Harshg999 merged 5 commits into
masterfrom
feat/trino-basic-support
Oct 30, 2026
Merged

Harshg999 merged 5 commits into
masterfrom
feat/trino-basic-support

Conversation

@Harshg999

Copy link
Copy Markdown
Collaborator

What changes are proposed in this pull request?

Fixes a set of problems in the native Trino connector (interface=trino) so that basic Trino support works reliably, and adds an opt-in switch for API-defined custom connectors.

Trino connector (notebook/connectors/trino.py)

  • Use basic authentication only over HTTPS (the Trino client refuses it over HTTP). Over http:// the credentials are ignored with a warning instead of failing. Empty auth_username / auth_password options fall back to the global defaults.
  • New options: ssl_verify (true, false or a CA bundle path) and trino_user (user sent to Trino, defaults to the Hue user).
  • The default port now follows the URL scheme (443 for https, 8080 otherwise).
  • Metadata queries (SHOW CATALOGS, tables, columns, schemas, sample data, explain) read all result pages. They previously read only the first page, so large results were cut.
  • SHOW SCHEMAS FROM quotes the catalog name, and USE is skipped when no database is given.
  • has_more is correct when the last fetched page still has rows to return.
  • Add cancel(), which deletes the Trino next URI.
  • The query error handler no longer uses the Python 2 only ex.message.
  • create_session no longer shares a mutable properties default.

[notebook] enable_custom_connectors (default false)

  • A snippet of type custom lets an API client choose the interface and options, so the host the Hue server connects to. It is now disabled by default and can be enabled by an admin.
  • Connectors defined in hue.ini are not affected.
  • The legacy RDBMS/JDBC importer builds its own custom snippets on the server and bypasses the flag.
  • Behavior change: API clients that rely on custom snippets need enable_custom_connectors=true.

Docs and config

  • Updated the Trino examples in hue.ini and pseudo-distributed.ini.tmpl and the connectors documentation. Added the new flag.

How was this patch tested?

  • Unit tests: 190 passed in notebook and indexer, including new tests for auth, ssl_verify, trino_user, paging, cancel, the gate and the interpreter config. Added a jest test for sqlUtils.backTickIfNeeded with the trino dialect (6 tests). ruff is clean on the changed files.
  • End to end against trinodb/trino:476 through the notebook API:
    • catalog, schema and table browsing, sample data and explain
    • error handling
    • paging (15,000 and 60,175 rows read exactly)
    • cancel (the query ends as USER_CANCELED on the server)
    • HTTPS with basic auth and a password file: ssl_verify as false, as a CA bundle path and as the default (refused for a self-signed certificate), auth_password_script, and a wrong password (clean 401)
    • trino_user
    • credentials over http://: ignored with a warning

Not covered: Kerberos, JWT and OAuth (not supported by this connector) and the browser UI itself.

…ify, trino_user, all result pages, cancel

- Use basic authentication only over HTTPS and fall back to the global credentials when the options are empty
- Add the ssl_verify and trino_user options and default the port from the URL scheme
- Read every page of the metadata queries, quote the catalog in SHOW SCHEMAS and skip USE without a database
- Fix has_more on the last page, add cancel and fix the Python 3 error handler
…ent by API clients

Custom snippets let an API client choose the interface and options and so the host the server connects to. They are now disabled by default and can be enabled with [notebook] enable_custom_connectors. The RDBMS and JDBC importer builds its own custom snippets on the server and is not affected.
@Harshg999 Harshg999 self-assigned this Oct 29, 2026
@github-actions

Copy link
Copy Markdown

✅ Test files were modified. Ensure that the tests cover all relevant changes. ✅

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

UI Code Coverage Report

Lines Statements Branches Functions
Coverage: 33%
40.16% (31638/78763) 32.07% (14993/46738) 26.41% (2415/9142)

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Coverage

Backend Code Coverage Report •
FileStmtsMissBranchBrPartCoverMissing
desktop/libs/indexer/src/indexer/indexers
   rdbms.py148119565415%37–39, 41, 43–48, 50–55, 57, 64->87, 66->75, 75–76, 85, 87–88, 90–93, 105–108, 110, 114–117, 119, 121, 125–139, 141–142, 144, 146–151, 153–158, 164–169, 175–180, 182–183, 189–190, 199–201, 203, 209–210, 212–217, 223, 228–229, 239–240, 243–244, 247–251, 257, 268–270, 273, 278, 293–294, 296, 300–301, 305
desktop/libs/notebook/src/notebook/connectors
   base.py4331901599053%56, 61, 76, 159, 161, 173, 175, 178, 180, 191, 193, 196, 198, 208, 210, 213, 215, 227, 229, 233, 235–242, 244, 258, 260, 263, 279, 281–282, 290, 292–294, 296, 306->307, 307, 315->340, 317->322, 340, 348, 350, 359->360, 360, 367->368, 368, 375->376, 376, 393->394, 394, 404->405, 405–408, 409->410, 410–411, 412->413, 413, 428->429, 429, 431->432, 432, 439->440, 440–441, 442->443, 443–444, 445->449, 469->470, 470, 471->472, 472–473, 474->475, 475–476, 477->478, 478–479, 480->481, 481–482, 483->484, 484–501, 503–504, 505->506, 506–507, 508->509, 509–510, 511->512, 512–513, 514->515, 515–516, 517->518, 518–519, 520->521, 521–522, 523->524, 524–525, 526->527, 527–528, 529->530, 530–531, 532->535, 535–539, 541, 545–547, 549, 563, 570, 573, 579, 596, 599, 602, 605, 608, 611, 618, 621, 624, 627–628, 630–631, 633, 636–637, 639, 641, 644–645, 647, 649, 652–655, 668–669, 671, 679–681, 684, 687–690, 693, 695->exit, 699->700, 700–703, 708, 713->714, 714, 728->741, 735->736, 736, 741->744, 744, 749->752, 752–755, 757–764, 766–767, 769–776, 779->exit
   trino.py301781104171%46->53, 53–55, 130->139, 175->176, 176, 186–187, 189–192, 194, 249->250, 250, 254->255, 255, 256->257, 257, 274->277, 280–281, 287->288, 288–289, 325->336, 350->351, 351, 375–377, 379, 388, 407–408, 410, 426–427, 429, 447->454, 461, 463–464, 466–467, 473–474, 477–479, 481–482, 484–485, 487–488, 490–493, 495, 498–499, 501–504, 506–515, 517–518, 520–528
TOTAL5685928774219371292347% 

@agl29 agl29 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@Harshg999
Harshg999 enabled auto-merge (rebase) October 30, 2026 07:40
@Harshg999
Harshg999 merged commit 95bb766 into master Oct 30, 2026
7 checks passed
@Harshg999
Harshg999 deleted the feat/trino-basic-support branch October 30, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants