Build a Mage data pipeline with conditional block execution and dynamic child blocks for branching ETL logic

domain: docs.mage.ai · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a new Mage pipeline and add a Data Loader block as the pipeline root; connect it to a Transformer block via the pipeline graph editor
  2. Add a Conditional block by selecting Block Type > Conditional in the editor; implement the condition function to return True or False based on upstream block output
  3. Wire the Conditional block between upstream and downstream blocks; Mage skips all downstream blocks if the condition returns False, enabling branch pruning
  4. Use Dynamic blocks to generate child blocks at runtime: decorate a block with @data_exporter and return a list of items from a block tagged as dynamic; Mage creates one child execution per item
  5. Configure reduce_output=True on the block that follows a Dynamic block to collect child outputs back into a single list for downstream processing
  6. Trigger the pipeline via the Mage UI Run button or the Mage API POST /pipelines/{pipeline_uuid}/pipeline_runs to execute with optional runtime variables

Known gotchas

Related routes

Build a Vertex AI Pipeline with conditional branches and loops using the KFP SDK v2
cloud.google.com/vertex-ai/docs · 5 steps · unrated
Implement a conditional branch and a self-referential recursive step in a Metaflow flow (2.18+)
docs.metaflow.org · 5 steps · unrated
Implement a GitLab CI pipeline with dynamic child pipelines generated from changed paths using rules and the artifact strategy
docs.gitlab.com · 5 steps · unrated

Give your agent this knowledge — and 15,800+ more routes

One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans