fix: bigquery_v1 global connection import and update-path adapter issues - #721
Open
dbtagarovat wants to merge 2 commits into
Open
fix: bigquery_v1 global connection import and update-path adapter issues#721dbtagarovat wants to merge 2 commits into
dbtagarovat wants to merge 2 commits into
Conversation
readGeneric (shared by Read and ImportState) never set BigQueryConfig.UseLatestAdapter, so imported/refreshed bigquery_v1 connections had it null in state. The ModifyPlan guard then compared that null (false) against the configured true and raised a false "Adapter version cannot be changed" error on a plain no-op plan. Derive UseLatestAdapter from the adapter version returned by the API, mirroring what Create already does after creating a v1 connection. Also guard sending timeout_seconds on Update: it's a bigquery_v0-only field and the API rejects it for bigquery_v1, but Update was sending it unconditionally whenever it differed from state. Closes #709
…709 - readGeneric now derives use_latest_adapter from the API's adapter version for both bigquery_v1 (true) and bigquery_v0 (false), instead of leaving it null. - ModifyPlan no longer false-positives "Adapter version cannot be changed" on a no-op plan once state correctly reflects use_latest_adapter, while still blocking a genuine v0<->v1 change. - Update no longer sends timeout_seconds to the API for bigquery_v1 connections (verified via the actual PATCH request body against a mock server), while still sending it for bigquery_v0. All four failure-mode tests verified to fail against the pre-fix code and pass with the fix applied.
5 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
readGeneric(shared byReadandImportState) never setBigQueryConfig.UseLatestAdapter, so importing (or refreshing) abigquery_v1dbtcloud_global_connectionleftuse_latest_adapter = nullin state. TheModifyPlanguard then compared that null (false) against the configuredtrueand raised a false "Adapter version cannot be changed on an existing connection" error on a plain no-op plan.UseLatestAdapterfrom the adapter version returned by the API inreadGeneric, mirroring whatCreatealready does explicitly after creating a v1 connection.Updateunconditionally senttimeout_secondswhenever it differed from state, buttimeout_secondsis abigquery_v0-only field that the API rejects forbigquery_v1.Createalready handles this correctly per-adapter;Updatenow does too.Verification
Also confirmed live against a real dbt Cloud backend (personal devspace):
main) provider, created abigquery_v1global connection (use_latest_adapter = true), removed it from state, then ranterraform importon the same connection — reproduced the exact reported error: "Adapter version cannot be changed on an existing connection" on a plan with zero config changes.plan— the false error is gone;use_latest_adapteris no longer part of the diff.Test plan
go build ./...go vet ./...go test ./pkg/framework/objects/global_connection/...(acceptance tests skip withoutTF_ACC, package compiles and unit-level checks pass)Closes #709