Hi experts , i need help in below dbt test issue ...
# random
r
Hi experts , i need help in below dbt test issue
Copy code
non_empty.sql 
{% test not_empty(model) %}

select 1
from (select COUNT(*) as cnt from {{ model }}) t
where cnt = 0;

{% endtest %}
Error
Copy code
17:21:17  Completed with 2 errors and 0 warnings:
17:21:17
17:21:17  Database Error in test not_empty (tests/not_empty.sql)
17:21:17    001003 (42000): SQL compilation error:
17:21:17    syntax error line 3 at position 4 unexpected ')'.
m
Hi @Ram, The syntax looks ok, maybe try to find the failed query in the query history? The only thing I can think of that will go wrong is if
model
won't be passed to the query
r
I was checking in dbt.log
Copy code
[0m09:21:28.553942 [debug] [Thread-1  ]: On test.product_metrics.not_empty: /* {"app": "dbt", "dbt_version": "1.5.0", "profile_name": "product_metrics", "target_name": "dev", "node_id": "test.product_metrics.not_empty"} */
with test_results as (
      
    )
    select * from test_results  limit 5
Looks like no query in it
c
I think you are maybe not meant to put a semi colon at the end of the test?