Skip to content


SQL is a declarative language. It does not natively have features like variables or control flow logic (if-then, for loops) that allow SQL commands to behave differently in different situations.

However, data pipelines are dynamic and need different behavior depending on context. SQL is made dynamic with macros.

SQLMesh supports two macro systems: SQLMesh macros and the Jinja templating system.

Learn more about macros in SQLMesh: