-
Notifications
You must be signed in to change notification settings - Fork 4
feat(dbt): add keboola_snowflake profile target and keboola adapter env vars #2570
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
aa23d76
feat(dbt): add keboola_snowflake profile target and keboola adapter e…
Matovidlo 5d80809
docs(dbt): clarify two-phase credential flow in comments
Matovidlo 2ddf5ca
test: update E2E fixture files for keboola_snowflake profile and adap…
Matovidlo d299813
fix: address round-3 PR review comments
Matovidlo c6c6d0f
fix: remove trailing blank lines (gci formatter)
Matovidlo 4d06d45
fix(dbt): remove password auth and --key-pair flag; always use key-pair
Matovidlo 6fda02c
fix(dbt): write KEBOOLA_TOKEN to .env.local; fix private key encoding
Matovidlo 1d453b4
fix(dbt): use private_key_path file instead of inline key in .env.local
Matovidlo 7866ae9
fix: address round-4 PR review comments
Matovidlo 499db9b
docs: clarify newline quoting intent and BaseURLFromHost non-keboola …
Matovidlo 31b7ca3
fix: address round-5 CI failures and new review comments
Matovidlo 00d03e7
fix: address round-6 PR review comments
Matovidlo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package dbtutil | ||
|
|
||
| import "strings" | ||
|
|
||
| // BaseURLFromHost derives the Keboola Query Service URL from the Storage API host. | ||
| // The input scheme (http:// or https://) is preserved; only the hostname prefix is rewritten. | ||
| // | ||
| // For standard Keboola stacks the "connection." prefix is replaced with "query.". | ||
| // For non-standard hosts (no "connection." prefix) "query." is prepended to the bare host. | ||
| // This is an intentional best-effort derivation — non-keboola.com hosts may produce | ||
| // unexpected results (e.g. "my.custom.host" → "https://query.my.custom.host"). | ||
| // | ||
| // Examples: | ||
| // | ||
| // "https://connection.keboola.com" → "https://query.keboola.com" | ||
| // "https://connection.eu-west-1.keboola.com" → "https://query.eu-west-1.keboola.com" | ||
| // "http://connection.keboola.com" → "http://query.keboola.com" | ||
| // "connection.keboola.com" → "https://query.keboola.com" (no scheme → https assumed) | ||
| // "my.custom.host" → "https://query.my.custom.host" (non-standard, best-effort) | ||
| func BaseURLFromHost(host string) string { | ||
| scheme := "https://" | ||
| bare := host | ||
| switch { | ||
| case strings.HasPrefix(host, "https://"): | ||
| bare = strings.TrimPrefix(host, "https://") | ||
| case strings.HasPrefix(host, "http://"): | ||
| scheme = "http://" | ||
| bare = strings.TrimPrefix(host, "http://") | ||
| } | ||
| return scheme + "query." + strings.TrimPrefix(bare, "connection.") | ||
|
Matovidlo marked this conversation as resolved.
|
||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package dbtutil_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
|
|
||
| "github.com/keboola/keboola-as-code/internal/pkg/service/cli/cmd/dbt/dbtutil" | ||
| ) | ||
|
|
||
| func TestBaseURLFromHost(t *testing.T) { | ||
| t.Parallel() | ||
| cases := []struct{ in, want string }{ | ||
| {"https://connection.keboola.com", "https://query.keboola.com"}, | ||
| {"https://connection.eu-west-1.keboola.com", "https://query.eu-west-1.keboola.com"}, | ||
| {"http://connection.keboola.com", "http://query.keboola.com"}, | ||
| {"connection.keboola.com", "https://query.keboola.com"}, | ||
| {"https://my-stack.keboola.com", "https://query.my-stack.keboola.com"}, | ||
| } | ||
| for _, tc := range cases { | ||
| t.Run(tc.in, func(t *testing.T) { | ||
| t.Parallel() | ||
| assert.Equal(t, tc.want, dbtutil.BaseURLFromHost(tc.in)) | ||
| }) | ||
| } | ||
| } | ||
|
Matovidlo marked this conversation as resolved.
|
||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.