The error is: Database Error in rpc request (from remote system.sql) 001003 (42000): SQL compilation error: syntax error line 1 at position 0 unexpected ‘limit’.
Database is Snowflake. I’m not able to provide compiled code as I cannot get the code to compile due to this error
Code from the training video is:
{% macro template_example() %}
{% set query %}
select true as bool
{% endset %}
{% if execute %}
{% set results = run_query(query).columns[0].values()[0] %}
{{ log("SQL results " ~ results, info=True) }}
select {{ results }} as is_real
from a_real_table
{% endif %}
{% end macro %}
I believe I have answered my own question. This error occurs when I try to compile macros, which I now see is not necessary. When I run them with dbt run-operation I have no trouble. I’m new to this platform and still learning…
Good solve @jjage5729! One other solution for the future - if you need to preview the behaviour of a macro, you can open a new Scratchpad and call it from there: