Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dbt: Adding query-comment in dbt_project.yml does not add query comments in compiled code

Tags:

dbt

I've added in dbt_project.yml the following code:

query-comment:
    comment: 'run by {{ target.user }} in dbt'

but after running the models in the compiled code in the target folder I do not see the comment which is supposed to be there.

I've tried to test the query-comment and using dbt run or dbt compile but in the target folder I do not see the comment. I am using a local postgres database. Models all run successfully but without comments in the compiled SQL.

like image 621
user49300 Avatar asked Mar 03 '26 17:03

user49300


1 Answers

If you're using Snowflake, you'll need to add the append:true option. With this option, dbt will append the comment at the end of the query (Snowflake automatically removes any comments that are at the beginning of the query)

like image 100
bajafresh4life Avatar answered Mar 05 '26 10:03

bajafresh4life



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!