Skip to main content

Batch

Split the data into batches for executing a list of wrangles. Use this in situations such as where the intermediate data is too large to fit in memory.

Execute a series of wrangles in batches. Batches can run in parallel with threads and can provide fallback output when an error occurs.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name.array, object—No
Execution
wranglesThe wrangles to execute on the data. Each series of wrangles will be run against the data in batches of the size defined by batch_size.array—Yes
batch_sizeThe number of rows to split each batch into.integer1000No
threadsThe number of threads to use for parallel processing. Default 1.integer1No
timeoutThe number of seconds to wait for a batch to complete before raising an error.number, nullnullNo
use_multiprocessingUse process-based workers instead of threads. This is an advanced runtime option.booleanfalseNo
Errors
on_errorA dictionary of column_name: value to return if an error occurs while attempting to run a batch.object, nullnullNo

Examples​

This example processes product descriptions in batches of two rows.

wrangles:
- batch:
batch_size: 2
threads: 1
wrangles:
- extract.ai:
api_key: Your OpenAI API key
input: Product Description
output:
Title:
type: string
description: Title of the product
Product Description
Sleep better with our Memory Foam Pillow, designed to contour to your head and neck.
Stay comfortable and stylish with our Organic Cotton T-Shirt, made from soft, breathable fabric.
Keep drinks hot or cold with our Stainless Steel Water Bottle, featuring durable insulation.
Enjoy crisp sound and long battery life with our Wireless Bluetooth Earbuds.
Title
Memory Foam Pillow
Organic Cotton T-Shirt
Stainless Steel Water Bottle
Wireless Bluetooth Earbuds
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID70
Catalog keybatch
Recipe keybatch
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
NamespaceRoot-level
Documentation grouputility
AliasesNone
Runtime symbolwrangles.recipe_wrangles.main.batch
Legacy UUIDNone

Sources