You are viewing documentation for an older version.
sql_models.yaml
less than a minute
You can write queries within the YAML file or in standalone sql files and reference them in the sql_template model. They have the same keys as an input model.
This data is saved in the model folder of a Profiles project, along with any referenced sql files.
models:
- name: name_of_sql_model
model_type: sql_template
model_spec:
<model-spec>| Key | Description |
|---|---|
nameRequired | SQL model name. |
model_typeRequired | Model type - set it to sql_template. |
model_specRequired | Model configuration. See SQL Model Spec for more information. |
Example
models:
- name:
model_type: sql_template
model_spec:
single_sql: |
{% with input_table = this.DeRef("inputs/rsIDS) %}
select
id,
first,
last
from
{{input_table}}
where
id_type = 'email'
{% endwith %}
ids:
select: "id"
type: user_id
entity: user