This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Add query_id of last executed statement to Adapter Response#891
Closed
KeltonKarboviak wants to merge 2 commits intodbt-labs:mainfrom
Closed
Add query_id of last executed statement to Adapter Response#891KeltonKarboviak wants to merge 2 commits intodbt-labs:mainfrom
query_id of last executed statement to Adapter Response#891KeltonKarboviak wants to merge 2 commits intodbt-labs:mainfrom
Conversation
I want to be able to capture the `query_id` of the statement used to load a model. I ripped this off of the dbt-snowflake adapter and how they are setting `query_id` on the adapter response: https://github.com/dbt-labs/dbt-snowflake/blob/f95b9192f6eec9af4e30eaab87f9e3412febf7d1/dbt/adapters/snowflake/connections.py#L456-L461 I'm sure this doesn't handle 100% of accurately capturing the correct query ID for a particular load (I'm sure there are cases where multiple statements are run in order to perform the model or snapshot load), but I think this is a good start.
Author
|
Well there is definitely a side effect to running the |
Contributor
|
This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days. |
Contributor
|
Although we are closing this PR as stale, it can still be reopened to continue development. Just add a comment to notify the maintainers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves dbt-labs/dbt-adapters#630
docs dbt-labs/docs.getdbt.com/#
Problem
I want to be able to capture the
query_idof the statement used to load a model.Solution
I ripped this off of the dbt-snowflake adapter and how they are setting
query_idon the adapter response:https://github.com/dbt-labs/dbt-snowflake/blob/f95b9192f6eec9af4e30eaab87f9e3412febf7d1/dbt/adapters/snowflake/connections.py#L456-L461
I realize it is different from Snowflake in that appears that the query ID is available directly on the
cursorobject, and with Redshift you need to use thepg_last_query_id()function in order to get the query ID.I'm sure this doesn't handle 100% of accurately capturing the correct query ID for a particular load (I'm sure there are cases where multiple statements are run in order to perform the model or snapshot load), but I think this is a good start.
Please let me know what I'm missing here in the potential of this breaking something else due to injecting another another query into a model load flow.
Checklist