I have to compare the result of query with hardcoded integer value in if condition
{%- set query %}
select cast(1 as integer)
{% endset -%}
{%- set main = run_query(query) -%}
{% if execute %}
{% if main > 2 %}
Getting below error…
'>' not supported between instances of 'Table' and 'int'
Hi @Bhrat123 , the result of run_query
is an Agate table, not an integer.
The Getting Started Guide has a section on using run_query
effectively - I would recommend reviewing that as well!
tekavec
September 4, 2022, 7:50pm
5
Hi Bhrat123,
‘main’ variable in your code is of ‘table’ type, it doesn’t hold the value of your query result. Check run_query | dbt Docs for more details, especially ‘columns’ property.
Cheers,
Tomaz
1 Like
system
Closed
September 23, 2022, 3:50am
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.