fornwall commented on PR #4475:
URL: https://github.com/apache/arrow-adbc/pull/4475#issuecomment-4910351656

   AI generated description for the gain for python clients:
   
   ## Motivation: what this fixes for (e.g.) Python clients
   
   The Python DBAPI layer wraps every result set (`cursor.fetchall()`,
   `fetch_arrow_table()`, `fetch_df()`, iteration) in `AdbcRecordBatchReader`
   (`python/adbc_driver_manager/adbc_driver_manager/_reader.pyx`), whose fetch 
methods catch any
   mid-stream failure and call `AdbcErrorFromArrayStream` to upgrade the 
exception to a proper
   ADBC error. For Rust-exported drivers that upgrade path is currently dead: 
the driver leaves
   the `ErrorFromArrayStream` slot unset, so the C driver manager doesn't wrap 
the stream and
   `AdbcErrorFromArrayStream` returns NULL.
   
   The result today: every mid-stream failure from a Rust driver reaches Python 
as
   `pyarrow.lib.ArrowInvalid` (the exporter's blanket `EINVAL`, mapped by Arrow 
C++'s stream
   import) carrying only a message string. It is not part of the DBAPI 
exception hierarchy, so
   `except adbc_driver_manager.dbapi.OperationalError:` handlers never fire; 
there is no status
   code, SQLSTATE, vendor code, or error details; and a query cancelled via
   `cursor.adbc_cancel()` is indistinguishable from malformed data.
   
   With this PR the driver advertises `ErrorFromArrayStream`, the driver 
manager wraps its
   streams, and Python's existing machinery (`convert_error`) does the rest: 
the same failure
   now raises the documented typed exception — e.g. `OperationalError` with
   `status_code=CANCELLED` for a cancelled query, `ProgrammingError` for 
NOT_FOUND/UNAUTHORIZED,
   `IntegrityError` for constraint violations — with `sqlstate`, `vendor_code`, 
and structured
   `details` populated from the driver's rich error. No Python-side changes 
needed; the client
   support has been there since ADBC 1.1.0, waiting on the driver.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to