Dataiku Recipe Patterns
Reference patterns for creating different recipe types via the Python API.
Before Writing Code
MANDATORY: Read the relevant reference file before writing any recipe code.
- GREL formulas → read references/grel-functions.md first
- Prepare steps → read references/processors.md first
- Joins → read references/join-recipe.md first
- Grouping → read references/group-recipe.md first
- Python recipes → read references/python-recipe.md first
- Sync recipes → read references/sync-recipe.md first
- Date handling → read references/date-operations.md first
- Pitfalls index → references/pitfalls.md (recipe-type reference files also have a Pitfalls section at the top)
Do NOT rely on general knowledge for GREL functions or API methods. Dataiku GREL differs from OpenRefine GREL and other variants. Always verify function names against the reference.
Recipe Type Decision Table
| Recipe Type |
Use When |
Key Method |
| Prepare |
Column transforms, filtering, formula columns, renaming, data cleaning |
project.new_recipe("prepare", ...) |
| Join |
Combining datasets on key columns (LEFT, INNER, RIGHT, OUTER) |
project.new_recipe("join", ...) |
| Group |
Aggregations: sum, count, avg, min, max, stddev, etc. |
project.new_recipe("grouping", ...) |
| Sync |
Copying data between connections (e.g., to a data warehouse) |
project.new_recipe("sync", ...) |
| Python |
Custom transformations not possible with visual recipes |
project.new_recipe("python", ...) |
Universal Builder Pattern
Every recipe follows the same create-configure-run lifecycle:
# 1. Create via builder
builder = project.new_recipe("<type>", "<recipe_name>")
builder.with_input("<input_dataset>")
builder.with_new_output("<output_dataset>", "<connection>") # creates output dataset
recipe = builder.create()
# 2. Configure settings
settings = recipe.get_settings()
# ... recipe-specific configuration ...
settings.save()
# 3. Apply schema updates
schema_updates = recipe.compute_schema_updates()
if schema_updates.any_action_required():
schema_updates.apply()
# 4. Run and check
job = recipe.run(no_fail=True)
state = job.get_status()["baseStatus"]["state"] # "DONE" or "FAILED"
After Running Any Recipe
Always sample the output and verify the result before reporting success. Silent data issues (wrong values, all nulls, unexpected types) are common.
from helpers.export import sample
rows = sample(client, "PROJECT_KEY", "output_dataset", 5)
for r in rows:
print(r)
Always Remember
- Call
settings.save() after configuration changes
- Call
compute_schema_updates().apply() for visual recipes
- Call
recipe.run(no_fail=True) to execute (already waits for completion)
- Check
job.get_status()["baseStatus"]["state"] for "DONE" or "FAILED"
- Sample and verify the output data before reporting success
Tested Patterns
Copy-paste patterns that have been validated against a live Dataiku instance:
- patterns/bin-numeric-column.py — Bin a string numeric column into ranges
- patterns/calculated-columns.py — Common GREL formula patterns
- patterns/filter-and-clean.py — Data cleaning pipeline
Detailed References
Recipe types:
- references/prepare-recipe.md — Prepare recipe builder,
add_processor_step() API
- references/join-recipe.md — Join configuration, multi-table joins, column selection
- references/group-recipe.md — Aggregation flags, output naming, type compatibility
- references/sync-recipe.md — Sync recipe pattern
- references/python-recipe.md — Python recipe with
set_code
Data preparation:
- references/processors.md — All processor types with parameters and complete example
- references/grel-functions.md — Full GREL function table and formula syntax
- references/date-operations.md — DateParser, DateFormatter, datePart examples
Troubleshooting:
- references/pitfalls.md — Index of all pitfalls (details are inline in each reference file)
1---2name: recipe-patterns3description: Use when creating, configuring, or running any Dataiku recipe (prepare, join, group, sync, python) including data cleaning, formulas, and GREL4---56# Dataiku Recipe Patterns78Reference patterns for creating different recipe types via the Python API.910## Before Writing Code1112**MANDATORY**: Read the relevant reference file before writing any recipe code.1314- GREL formulas → read [references/grel-functions.md](references/grel-functions.md) first15- Prepare steps → read [references/processors.md](references/processors.md) first16- Joins → read [references/join-recipe.md](references/join-recipe.md) first17- Grouping → read [references/group-recipe.md](references/group-recipe.md) first18- Python recipes → read [references/python-recipe.md](references/python-recipe.md) first19- Sync recipes → read [references/sync-recipe.md](references/sync-recipe.md) first20- Date handling → read [references/date-operations.md](references/date-operations.md) first21- Pitfalls index → [references/pitfalls.md](references/pitfalls.md) (recipe-type reference files also have a Pitfalls section at the top)2223**Do NOT rely on general knowledge for GREL functions or API methods.** Dataiku GREL differs from OpenRefine GREL and other variants. Always verify function names against the reference.2425## Recipe Type Decision Table2627| Recipe Type | Use When | Key Method |28|-------------|----------|------------|29| **Prepare** | Column transforms, filtering, formula columns, renaming, data cleaning | `project.new_recipe("prepare", ...)` |30| **Join** | Combining datasets on key columns (LEFT, INNER, RIGHT, OUTER) | `project.new_recipe("join", ...)` |31| **Group** | Aggregations: sum, count, avg, min, max, stddev, etc. | `project.new_recipe("grouping", ...)` |32| **Sync** | Copying data between connections (e.g., to a data warehouse) | `project.new_recipe("sync", ...)` |33| **Python** | Custom transformations not possible with visual recipes | `project.new_recipe("python", ...)` |3435## Universal Builder Pattern3637Every recipe follows the same create-configure-run lifecycle:3839```python40# 1. Create via builder41builder = project.new_recipe("<type>", "<recipe_name>")42builder.with_input("<input_dataset>")43builder.with_new_output("<output_dataset>", "<connection>") # creates output dataset44recipe = builder.create()4546# 2. Configure settings47settings = recipe.get_settings()48# ... recipe-specific configuration ...49settings.save()5051# 3. Apply schema updates52schema_updates = recipe.compute_schema_updates()53if schema_updates.any_action_required():54 schema_updates.apply()5556# 4. Run and check57job = recipe.run(no_fail=True)58state = job.get_status()["baseStatus"]["state"] # "DONE" or "FAILED"59```6061## After Running Any Recipe6263**Always sample the output and verify the result before reporting success.** Silent data issues (wrong values, all nulls, unexpected types) are common.6465```python66from helpers.export import sample67rows = sample(client, "PROJECT_KEY", "output_dataset", 5)68for r in rows:69 print(r)70```7172## Always Remember73741. Call `settings.save()` after configuration changes752. Call `compute_schema_updates().apply()` for visual recipes763. Call `recipe.run(no_fail=True)` to execute (already waits for completion)774. Check `job.get_status()["baseStatus"]["state"]` for `"DONE"` or `"FAILED"`785. **Sample and verify the output data** before reporting success7980## Tested Patterns8182Copy-paste patterns that have been validated against a live Dataiku instance:8384- [patterns/bin-numeric-column.py](references/patterns/bin-numeric-column.py) — Bin a string numeric column into ranges85- [patterns/calculated-columns.py](references/patterns/calculated-columns.py) — Common GREL formula patterns86- [patterns/filter-and-clean.py](references/patterns/filter-and-clean.py) — Data cleaning pipeline8788## Detailed References8990**Recipe types:**91- [references/prepare-recipe.md](references/prepare-recipe.md) — Prepare recipe builder, `add_processor_step()` API92- [references/join-recipe.md](references/join-recipe.md) — Join configuration, multi-table joins, column selection93- [references/group-recipe.md](references/group-recipe.md) — Aggregation flags, output naming, type compatibility94- [references/sync-recipe.md](references/sync-recipe.md) — Sync recipe pattern95- [references/python-recipe.md](references/python-recipe.md) — Python recipe with `set_code`9697**Data preparation:**98- [references/processors.md](references/processors.md) — All processor types with parameters and complete example99- [references/grel-functions.md](references/grel-functions.md) — Full GREL function table and formula syntax100- [references/date-operations.md](references/date-operations.md) — DateParser, DateFormatter, datePart examples101102**Troubleshooting:**103- [references/pitfalls.md](references/pitfalls.md) — Index of all pitfalls (details are inline in each reference file)