@@ -266,7 +266,7 @@ def read_sql(
266266 query : list [str ] | str ,
267267 * ,
268268 return_type : Literal [
269- "pandas" , "polars" , "arrow" , "modin" , "dask" , "arrow_record_batches "
269+ "pandas" , "polars" , "arrow" , "modin" , "dask" , "arrow_stream "
270270 ] = "pandas" ,
271271 protocol : Protocol | None = None ,
272272 partition_on : str | None = None ,
@@ -288,7 +288,7 @@ def read_sql(
288288 query
289289 a SQL query or a list of SQL queries.
290290 return_type
291- the return type of this function; one of "arrow(2) ", "arrow_record_batches ", "pandas", "modin", "dask" or "polars(2) ".
291+ the return type of this function; one of "arrow", "arrow_stream ", "pandas", "modin", "dask" or "polars".
292292 protocol
293293 backend-specific transfer protocol directive; defaults to 'binary' (except for redshift
294294 connection strings, where 'cursor' will be used instead).
@@ -301,10 +301,12 @@ def read_sql(
301301 index_col
302302 the index column to set; only applicable for return type "pandas", "modin", "dask".
303303 strategy
304- strategy of rewriting the federated query for join pushdown
304+ strategy of rewriting the federated query for join pushdown.
305305 pre_execution_query
306306 SQL query or list of SQL queries executed before main query; can be used to set runtime
307307 configurations using SET statements; only applicable for source "Postgres" and "MySQL".
308+ batch_size
309+ the maximum size of each batch when return type is `arrow_stream`.
308310
309311 Examples
310312 ========
@@ -431,16 +433,16 @@ def read_sql(
431433 except AttributeError :
432434 # previous polars api (< 0.8.*) was pl.DataFrame.from_arrow
433435 df = pl .DataFrame .from_arrow (df )
434- elif return_type in {"arrow_record_batches " }:
435- record_batch_size = int (kwargs .get ("record_batch_size " , 10000 ))
436+ elif return_type in {"arrow_stream " }:
437+ batch_size = int (kwargs .get ("batch_size " , 10000 ))
436438 result = _read_sql (
437439 conn ,
438- "arrow_record_batches " ,
440+ "arrow_stream " ,
439441 queries = queries ,
440442 protocol = protocol ,
441443 partition_query = partition_query ,
442444 pre_execution_queries = pre_execution_queries ,
443- record_batch_size = record_batch_size
445+ batch_size = batch_size
444446 )
445447
446448 df = reconstruct_arrow_rb (result )
0 commit comments