-
Notifications
You must be signed in to change notification settings - Fork 155
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
Patch for dbt show
for a model with a struct
column containing a json
datatype
#974
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9b93327
patch for --show with json
matt-winkler a5c9b8c
update matts handle in changelog
matt-winkler e49cfc0
Update dbt/adapters/bigquery/connections.py
matt-winkler a32baf1
add json struct functional test
colin-rogers-dbt 30f817e
remove old change log
matt-winkler b01397e
add comment to test
colin-rogers-dbt 8b6bd15
Merge remote-tracking branch 'origin/mwinkler/json-show-patch' into m…
colin-rogers-dbt 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
There are no files selected for viewing
This file contains 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,6 @@ | ||
kind: Fixes | ||
body: Patch for json inline --show | ||
time: 2023-10-23T08:23:12.245223-06:00 | ||
custom: | ||
Author: matt-winkler | ||
Issue: "972" |
This file contains 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 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 |
---|---|---|
@@ -1,9 +1,46 @@ | ||
import pytest | ||
from dbt.tests.adapter.dbt_show.test_dbt_show import BaseShowSqlHeader, BaseShowLimit | ||
|
||
from dbt.tests.util import run_dbt | ||
|
||
model_with_json_struct = """ | ||
select * | ||
from ( | ||
select | ||
struct< | ||
k array< | ||
struct<c1 int64, c2 json> | ||
> | ||
>( | ||
[ | ||
struct( | ||
1 as c1, | ||
to_json(struct(1 as a)) as c2 | ||
) | ||
] | ||
) | ||
as v | ||
) as model_limit_subq | ||
limit 5 | ||
""" | ||
|
||
|
||
class TestBigQueryShowLimit(BaseShowLimit): | ||
pass | ||
|
||
|
||
class TestBigQueryShowSqlHeader(BaseShowSqlHeader): | ||
pass | ||
|
||
|
||
# Added to check if dbt show works with JSON struct | ||
# Addresses: https://github.com/dbt-labs/dbt-bigquery/issues/972 | ||
class TestBigQueryShowSqlWorksWithJSONStruct: | ||
dbeatty10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"json_struct_model.sql": model_with_json_struct, | ||
} | ||
|
||
def test_sql_header(self, project): | ||
run_dbt(["show", "--select", "json_struct_model"]) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.