return

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/example.sql
{% macro get_data() %}
{{ return([1,2,3]) }}
{% endmacro %}
models/my_model.sql
select
-- getdata() returns a list!
{% for i in getdata() %}
{{ i }}
{% if not loop.last %},{% endif %}
{% endfor %}