1. Home
  2. Docs
  3. Getting started
  4. Global models

Global models

1. What are global models #

Global models are models which can be included in workflows. This is helpful if you have multiple projects which should use the same transformation.

2. Basic global model #

{{ block "CONFIG" .}}
{{end}}

{{ block "SELECT" .}}
  {{ globalmodel "bla/blub" . }}
{{end}}

Create a folder bla in the global models folder:

mkdir globals/models/bla

No create a file called blub.le.sql in this folder :

touch globals/models/bla/blub.le.sql

Now add a SELECT statement in it.

SELECT
  x,
  y,
  z
FROM
  {{ ref "table1" }}

3. Global models with variables - the real power #

You define variables in the CONFIG block of the local model and use these variables in the global model.