lidavidm commented on code in PR #989:
URL: https://github.com/apache/arrow-adbc/pull/989#discussion_r1302335522
##########
python/adbc_driver_manager/adbc_driver_manager/dbapi.py:
##########
@@ -926,6 +927,44 @@ def fetch_df(self) -> "pandas.DataFrame":
)
return self._results.fetch_df()
+ def fetch_record_batch(self, rows_per_batch: int) ->
Optional["_BatchIterator"]:
+ """
+ Fetch #(rows_per_batch) batches akin to
+
https://duckdb.org/docs/guides/python/export_arrow.html#export-as-a-recordbatchreader
+
+ Notes
+ -----
+ This is an extension and not part of the DBAPI standard.
+ """
+ if self._results is None:
+ raise ProgrammingError(
+ "Cannot fetch_record_batch() before execute()",
+ status_code=_lib.AdbcStatusCode.INVALID_STATE,
+ )
+ self._batched_results = _BatchIterator(self._results._reader,
rows_per_batch)
+ return self._batched_results
+
+ def read_next_batch(self) -> List[Optional[tuple]]:
Review Comment:
Also it should just return a pyarrow.RecordBatch
--
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]