Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/snowflake/snowpark/dataframe_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ def dbapi(
session_init_statement: Optional[Union[str, List[str]]] = None,
udtf_configs: Optional[dict] = None,
fetch_merge_count: int = 1,
enable_multiprocessing: bool = False,
_emit_ast: bool = True,
) -> DataFrame:
"""
Expand Down Expand Up @@ -1259,6 +1260,7 @@ def dbapi(
before uploading it. This improves performance by reducing the number of
small Parquet files. Defaults to 1, meaning each `fetch_size` batch is written to its own
Parquet file and uploaded separately.
enable_multiprocessing: Whether to use multiprocessing for parallel fetching.

Example::
.. code-block:: python
Expand Down Expand Up @@ -1344,8 +1346,12 @@ def create_oracledb_connection():
statement_params=statements_params_for_telemetry, _emit_ast=False
)

fetch_executor = (
ProcessPoolExecutor if enable_multiprocessing else ThreadPoolExecutor
)

try:
with ProcessPoolExecutor(
with fetch_executor(
max_workers=max_workers
) as process_executor, ThreadPoolExecutor(
max_workers=max_workers
Expand Down
Loading