Skip to main content

About return function

Args:

  • data: The data to return to the caller

The return function can be used in macros to return data to the caller. The type of the data (dict, list, int, etc) will be preserved through the return call.

macros/get_data.sql
{% macro get_data() %}

{{ return([1,2,3]) }}

{% endmacro %}
models/my_model.sql

select
-- getdata() returns a list!
{% for i in get_data() %}
{{ i }}
{% if not loop.last %},{% endif %}
{% endfor %}
0