Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Missing query-comments on insert statements for seeds #9647

Open
2 tasks done
OFlanagan opened this issue Feb 23, 2024 · 2 comments
Open
2 tasks done

[Bug] Missing query-comments on insert statements for seeds #9647

OFlanagan opened this issue Feb 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@OFlanagan
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Queries run against redshift do not all have the query-comment appended at the start.
This query-comment is present for many CREATE and DELETE commands but is missing for inserts for seeds (the insert does not have query comments)

Expected Behavior

the documentation states "A string to inject as a comment in each query that dbt runs against your database"
This means that the above inserts should also include the query-comment
https://docs.getdbt.com/reference/project-configs/query-comment

Steps To Reproduce

define a seed in your dbt project
ensure query-comments are enabled for your project
run dbt run --select seed_name

Relevant log output

No response

Environment

- OS: Amazon Linux 23
- Python: 3.11.6
- dbt-core: 1.6.6

Which database adapter are you using with dbt?

redshift

Additional Context

Spun off of #9617

@OFlanagan OFlanagan added bug Something isn't working triage labels Feb 23, 2024
@OFlanagan
Copy link
Author

@dbeatty10 FYI

@dbeatty10
Copy link
Contributor

Suspected root cause

I suspect that the noop_statement called for the seed materialization here isn't including query comments for some reason.

However, regular statement does include the query comments via adapter.execute.

Reprex

Create this seed file:

seeds/my_seed.csv

id
1

Run these commands:

dbt clean
dbt seed --full-refresh

Open logs/dbt.log.

See that query comments are applied to the CTAS:

13:07:57.639380 [debug] [Thread-1 (]: On seed.my_project.my_seed: /* {"app": "dbt", "dbt_version": "1.7.8", "profile_name": "postgres", "target_name": "postgres", "node_id": "seed.my_project.my_seed"} */

    create table "postgres"."dbt_dbeatty"."my_seed" ("id" integer)

But see that they are missing for the insert statement:

[0m13:07:57.660162 [debug] [Thread-1 (]: On seed.my_project.my_seed: 
          insert into "postgres"."dbt_dbeatty"."my_seed" ("id") values
          (%s)
      ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants