Repository navigation
Retrospective review: changes in 1.1.11.4-1.1.11.5 (merged without review) - #15
Conversation
Drill 1.19+ REST returns DATE, TIME and TIMESTAMP as epoch milliseconds. The decoders treated 0 as NULL, so 1970-01-01, midnight TIME and the epoch TIMESTAMP were returned as None, and time.gmtime() dropped the millisecond fraction. Decode with timedelta and map only None to None. Bump to 1.1.11.4.
Drill publishes view SQL in INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION, but the dialect did not implement get_view_definition(), so SQLAlchemy raised NotImplementedError. Read it with bound schema/view names and raise NoSuchTableError for an unknown view.
URL query values are strings and requests treats any string verify value as a CA bundle path, so verify_ssl=true failed with an invalid-path OSError. Map true/false spellings to booleans; keep other values as a CA bundle path and leave the default unchanged.
- request_timeout=<seconds> (URL query parameter) bounds every REST
request and raises OperationalError; unset keeps today's behaviour of
no client-side limit.
- Cursor.cancel() / Connection.cancel_query() use Drill's
/profiles/cancel/{queryId} endpoint. Drill REST sends the query ID only
with the first result batch, so earlier cancellation is reported as
NotSupportedError. Cursor.get_query_id() no longer raises.
- Poll a failed query's profile for about 5 s instead of 0.3 s, so a
provably absent table on a busy server still yields False or
NoSuchTableError. The opaque REST error text is never used as evidence.
…nections, cancel before first batch - use_ssl now verifies certificates against the system trust store unless verify_ssl names a CA bundle or explicitly disables verification. - A debug log line evaluated Response.text for every query, reading the whole streamed body into memory; streamed bodies are never read eagerly and are parsed in 64 KiB chunks instead of byte by byte. - requests failures become DB-API TransportError (OperationalError) and the REST dialect reports them and closed connections as disconnects, so pool_pre_ping replaces a dead pooled connection. Cursor.close() works on a closed connection. - Cursor statements carry a per-cursor tag comment; Cursor.cancel() finds the tagged statement in Drill's running-query list, so a query can be cancelled before its first result batch.
fix: REST temporal decoding, view definitions, verify_ssl flags, timeout and cancel
…collections - INFORMATION_SCHEMA lists a single `**` placeholder column for dynamic schemas (e.g. Kafka topics); read the real columns from a LIMIT 1 probe. - Prove a missing MongoDB collection from a missing-object diagnostic and a fresh, complete, nonempty INFORMATION_SCHEMA.TABLES listing without it; otherwise keep the original error. Bump to 1.1.11.5.
- Document that 1.1.11.4 verifies HTTPS certificates by default (a breaking change; the release notes said unchanged) and raise an actionable error naming verify_ssl=<CA bundle path> when verification fails. Verification is never disabled automatically. - Bound the whole query-profile poll by request_timeout (else 30 s) instead of 30 s per request. - Tag each statement, not each cursor, so Cursor.cancel() only reaches the cursor's latest statement. - get_view_definition() without any schema searched TABLE_SCHEMA = NULL; search all schemas and require a unique match. - Cancel the server statement when request_timeout expires.
Cursor.cancel_group (32 lowercase hex characters) adds a shared ID to every statement's tag comment; Connection.cancel_query_group() cancels whichever of those statements is running. Callers that must pick a cancel ID before executing (a SQL editor's Stop button) can then cancel from another connection. Per-statement tags and Cursor.cancel() are unchanged; tags are matched by parsing the leading comment, never by substring.
A refused connection now raises DB-API TransportError, which the dialect reports as a disconnect, so SQLAlchemy invalidates the connection. The test forced that onto the module-scoped drill_conn, leaving it with an invalid transaction, and every later live test in the module failed with PendingRollbackError. Use a dedicated connection and assert the new contract: OperationalError wrapping TransportError caused by the refused connection, with the connection invalidated.
…(p, s) REST results returned DOUBLE/FLOAT values as Decimal, and NaN, Infinity and -Infinity as strings, although the cursor description reports FLOAT. FLOAT4 and FLOAT8 values are now Python floats. Drill reports DECIMAL columns of file-backed tables (e.g. Parquet) as VARDECIMAL(p, s), which reflection mapped to UserDefinedType. They now reflect as DECIMAL(p, s), and the cursor description carries precision and scale. Bumps the version to 1.1.11.6.
…them Branch builds of a stable version now use a +branch.<sha> local version, run the tests and the wheel build, and skip only the publish steps. master still publishes the stable version; PR builds are unchanged.
fix: post-release review of 1.1.11.4 (TLS upgrade path, timeouts, per-statement cancel) and plugin reflection
fix: decode FLOAT columns as floats and reflect VARDECIMAL as DECIMAL(p, s)
fitzee
left a comment
There was a problem hiding this comment.
This was merged into review/base-1.1.11.3 at 2026-09-29T16:24:56Z with no approving review, despite "do not merge". Master is unaffected, but it closes the review venue. The findings below are for the snapshot and need follow-up PRs. Everything was reproduced on Apache Drill 1.22.0 (embedded) with requests 2.34.2 and SQLAlchemy 2.0.54 unless marked otherwise.
[HIGH] Repeated DATE/TIME/TIMESTAMP columns crash fetch and reflection. #14 doesn't fix this.
sqlalchemy_drill/drilldbapi/_drilldbapi.py:1076-1112. Same class as the FLOAT array bug. Drill sends repeated temporal columns with scalar metadata (DATE/TIMESTAMP/TIME) and list values, e.g. "ds":[1577923200000,0], and a NULL list as []. timedelta(milliseconds=[...]) raises TypeError, which isn't a DB-API error.
- Non-empty arrays crash on 1.1.11.3, 1.1.11.6 and master/1.1.11.7 (
ef8e6cf). - Regression: empty or NULL arrays returned
Noneon 1.1.11.3 and crash from 1.1.11.4 on. inspect(engine).get_columns()on a Parquet file with alist<date32>column crashes, because_probe_columns(sqlalchemy_drill/base.py:741) callsfetchall()on theLIMIT 1probe. On 1.1.11.3 it returned[('id', INTEGER()), ('ds', DATE())].
Fix: handle list and dict in the temporal casters the way _float_from_json does in #14. Add empty, NULL and non-empty array fixtures for all three types to the live test. Ship it as 1.1.11.8.
[MEDIUM] Cursor.cancel() and cancel-on-timeout do nothing under impersonation when the proxy user isn't an admin.
_drilldbapi.py:723-791. /profiles/running.json only lists queries the logged-in user can manage.
- Test:
drilluser=alice,impersonation_target=bob, alice not insecurity.admin.users. cancel()returnedFalseon a running query.- After
request_timeout=3, bob's query was still RUNNING. The only trace is a WARNING log. - Without impersonation, both cancel and timeout-cancel work.
This is how Superset's Drill impersonation works. Fix: document that the proxy user must be an admin, and log explicitly when no tagged query is visible. Scope the CHANGELOG's timeout-cancellation claims to match.
[MEDIUM] REQUESTS_CA_BUNDLE / CURL_CA_BUNDLE override verify_ssl, which breaks the TLS migration path.
_drilldbapi.py:870 sets session.verify, and requests replaces that with the environment bundle whenever the per-request verify is None. Against a self-signed server with REQUESTS_CA_BUNDLE set:
verify_ssl=<CA path>fails, and the error says the server is "not trusted by the CA bundle ''";verify_ssl=falsestill verifies.
Both work without the variable. Fix: store the setting and pass verify= explicitly on every post/get (login, query, cancel, profile reads).
[MEDIUM, security] use_ssl=1 / TRUE / yes silently uses plain HTTP.
_drilldbapi.py:868,871 only accept True/'True'/'true'. The new verify_ssl parser in sqlalchemy_drill/sadrill.py accepts 1/yes in any case. So ?use_ssl=1&verify_ssl=1 looks verified but connects to http://, and credentials travel unencrypted. Reproduced for all three spellings. The parsing is old; #10 made it easier to trip. Fix: parse use_ssl with the same flag set, and reject unknown values.
[LOW-MEDIUM] Closing a partly fetched cursor leaves the Drill query running.
_drilldbapi.py:375-383, 432. close() closes the row generator but not the requests response, and Connection.close() → Session.close() doesn't close it either.
- After
fetchmany(10)on a ~667k-row join and thenresult.close(), the query was still RUNNING 15 s later. - It was still running after
engine.dispose()while the result object was alive. It ends only when garbage collection drops the response. - On 1.1.11.3 the body was read in full, so the query finished.
Fix: keep the response, resp.close() it in Cursor.close(), and cancel by tag if the stream wasn't fully read.
[LOW] pool_pre_ping doesn't recover from an expired Drill web session.
With auth on and drill.exec.http.session_max_idle_secs=8, the first checkout after 15 s idle failed with DatabaseError 'HTTP 405 Method Not Allowed'. is_disconnect (sadrill.py:79) doesn't treat that as a disconnect, so the checkout raises; the second attempt reconnects. Fix: map a redirect to login, 401 or 405 from /query.json to TransportError, or log in again.
[LOW] Timeout-cancel doubles the caller's wait on a stalled server.
_drilldbapi.py:419-421,783. With the drillbit paused and request_timeout=3, execute() raised after 6.0 s, because /profiles/running.json is read with the same timeout before re-raising. Fix: use a short fixed timeout for the cancel lookup, or take it off the caller's path.
[LOW] A query timeout counts as a disconnect.
sadrill.py:79 matches TransportError(timed_out=True), so one slow statement invalidates the connection and SQLAlchemy marks the whole pool invalidated. Every thread's connection then logs in again. Fix: exclude timed_out from is_disconnect, or document it.
[LOW] A wrong verify_ssl CA path raises a raw OSError ("Could not find a suitable TLS CA certificate bundle"). The login try in connect() only catches RequestException, so this escapes as a non-DB-API error.
Checked, no defect:
- Zero-epoch, negative and millisecond temporal values.
drill_version >= '1.19': lexically wrong only for 1.2–1.9, and the casters only run when metadata precedes rows.- Cancel before the first batch at 0 / 50 ms / 1 s without impersonation.
- Timeout-cancel without impersonation.
- Jenkins gating: only master publishes stable.
- Unit suite: 360 pass.
Verdict: Needs changes. Stable 1.1.11.7 still has the HIGH temporal-array crash; the next corrective release should include the fix.
|
@fitzee this was merged before review because the SQLAlchemy 2 release couldn't wait. Could you review it after the fact? Anything you find will be fixed in a follow-up PR. |
Retrospective review only — do not merge
These release changes reached master without a submitted review. This PR provides a stable, reviewable diff; approval is not assumed, and opening it does not make any existing pin reviewed. Do not merge this comparison branch into its historical base or into master.
Exact comparison
review/base-1.1.11.3:2c14016(release 1.1.11.3, immediately before fix: REST correctness, TLS verification, bounded streaming, reconnect and cancel #10).review/merged-1.1.11.4-1.1.11.6:96ff31162426f91f0ea60d76c8b495ee935376b2, the current master snapshot.f4488b7, 1.1.11.4), fix: post-release review of 1.1.11.4 (TLS upgrade path, timeouts, per-statement cancel) and plugin reflection #12 (ab1f2d2, 1.1.11.5), and fix: decode FLOAT columns as floats and reflect VARDECIMAL as DECIMAL(p, s) #13 (96ff311, 1.1.11.6), which had already landed. The requested title names 1.1.11.4–1.1.11.5; the actual diff also includes fix: decode FLOAT columns as floats and reflect VARDECIMAL as DECIMAL(p, s) #13.Changes to review
#10 / 1.1.11.4
verify_ssloptions correctly. HTTPS certificates are verified by default starting in 1.1.11.4: private-CA/self-signed deployments needverify_ssl=<CA bundle path>; the former unverified default is not retained.#12 / 1.1.11.5
#13 / 1.1.11.6
Evidence and limits
Historical evidence, not freshly rerun in this PR:
Fresh 2026-09-29 control against this head's package code: Drill 1.22.0, both URL spellings, JSON/Parquet repeated floats and scalar controls: 4 fail / 2 pass. #14 gives 6/6 pass on SQLAlchemy 2.0.52 and 1.4.54; unit/distribution checks 424 pass and 423 pass / 1 version-specific skip respectively. Reproduction.
The Shell rollout note/audit for
drill+sadrillrows usinguse_ssl, and any #5276 repin/status change, remain integration work; this review PR does not change Shell.