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] Duplicated query comments for snapshots #1274

Open
2 tasks done
mwojcik321 opened this issue Dec 12, 2024 · 0 comments
Open
2 tasks done

[Bug] Duplicated query comments for snapshots #1274

mwojcik321 opened this issue Dec 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mwojcik321
Copy link

Is this a new bug in dbt-snowflake?

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

Current Behavior

Queries executed during the snapshot run contain duplicate comments:

select * from (
        select to_timestamp_ntz(convert_timezone('UTC', current_timestamp())) as dbt_snapshot_time
    ) as __dbt_sbq
    where false
    limit 0
/* {"dbt_version": "1.9.0", "invocation_id": "9f3fa140-f4e8-40a0-a0a7-cf83fadd5529", ...} */
/* {"dbt_version": "1.9.0", "invocation_id": "9f3fa140-f4e8-40a0-a0a7-cf83fadd5529", ...} */

Expected Behavior

The query comment should be added only once to the query:

select * from (
        select to_timestamp_ntz(convert_timezone('UTC', current_timestamp())) as dbt_snapshot_time
    ) as __dbt_sbq
    where false
    limit 0
/* {"dbt_version": "1.9.0", "invocation_id": "9f3fa140-f4e8-40a0-a0a7-cf83fadd5529", ...} */

Steps To Reproduce

  1. Configure query comments in dbt_project.yml:
query-comment:
  comment: "{{ get_query_comment(node) }}"
  append: true  # Snowflake removes prefixed comments.
  1. Add example snapshot
  2. Execute dbt snapshot command

Relevant log output

No response

Environment

- OS: Linux
- Python: 3.11
- dbt-core: 1.8.4 and 1.9.0
- dbt-snowflake: 1.8.4 and 1.9.0

Additional Context

It appears that the issue is linked to the method add_select_query in the dbt-adapters package, which is responsible for adding the query comment. Subsequently, the query is processed by add_standard_query in the dbt-snowflake package, which adds another query comment.

@mwojcik321 mwojcik321 added bug Something isn't working triage labels Dec 12, 2024
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