Macro Processing
Macro Processing Overview
SDF supports several macro processing features out of the box that enable compilation of queries containing Jinja and SQL Variables.
Macro Processing is critical to implementing DRY patterns, simplifying query writing, and enabling dynamic query generation.
SDF supports two types of macros:
- Jinja Macros - Similar to other frameworks like DBT and Airflow, SDF supports Jinja macros for templating and dynamic query generation.
- SDF Variables - Modeled after SQL Variables common in SQL dialects like BigQuery, SDF supports SQL Variables for parameterizing queries. SDF variables can be used anywhere as SQL variables or Jinja variables
Both of these are preprocessed before compilation and execution.
Jinja
Jinja unlocks the full power of Python for dynamic query generation.
SDF Variables
SDF SQL Variables are the simplest way to parameterize your queries per-command.
To get familiar with Jinja templating, check out our Introduction to Jinja guide.