3.10 Adding blocks

Lesson

3.10 Adding blocks

Creating blocks in Mage Pro is intuitive and follows a consistent pattern across all block types. This section walks you through the step-by-step process of adding any type of block to your pipeline, from data loaders to transformers to exporters.

Universal block creation process

Every block in Mage Pro follows the same creation workflow, regardless of its type:

Step 1: Access the block menu

  • From your pipeline editor, locate the "Add block" section

  • This typically appears as a "+" button or "Blocks" menu in the pipeline interface

Step 2: Choose your block type

  • Data loader: For connecting to data sources

  • Transformer: For data cleaning and transformation

  • Data exporter: For writing data to destinations

  • R: For R based ETL processes

  • SQL: For SQL-based transformations

  • Scratchpad: For experimentation and analysis

  • Sensor: For waiting on external conditions

  • dbt: For dbt model integration

  • Extension: For custom functionality

Step 3: Select a template

  • Choose from pre-built templates that match your data source or use case

  • Templates provide starter code with proper imports and structure

  • Custom templates let you start with a blank slate

Step 4: Write your code

  • Implement your logic within the provided template structure

  • Use the appropriate decorator for your block type (@data_loader, @transformer, etc.)

  • Include test functions to validate your block's output

Step 5: Run and test your block

  • Click the Run code button to see a sample output of your code