Skip to content

Commit

Permalink
Merge branch '1.7.latest' into source-freshness/metadata-based-1.7.la…
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
colin-rogers-dbt authored Jan 18, 2024
2 parents 1edadf7 + 8a2b9ed commit 1a3917a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231219-153446.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: remove json patch to leverage bigquery-python improvement
time: 2023-12-19T15:34:46.843931-08:00
custom:
Author: colin-rogers-dbt
Issue: "1055"
12 changes: 1 addition & 11 deletions dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import google.auth
import google.auth.exceptions
import google.cloud.bigquery as bigquery
import google.cloud.bigquery
import google.cloud.exceptions
from google.api_core import retry, client_info
from google.auth import impersonated_credentials
Expand Down Expand Up @@ -63,16 +63,6 @@
)


# Override broken json deserializer for dbt show --inline
# can remove once this is fixed: https://github.com/googleapis/python-bigquery/issues/1500
def _json_from_json(value, _):
"""NOOP string -> string coercion"""
return json.loads(value)


bigquery._helpers._CELLDATA_FROM_JSON["JSON"] = _json_from_json


@lru_cache()
def get_bigquery_defaults(scopes=None) -> Tuple[Any, Optional[str]]:
"""
Expand Down
8 changes: 8 additions & 0 deletions tests/functional/adapter/dbt_show/test_dbt_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
limit 5
"""

model_with_null_json_struct = """
select (struct<k json>(null)) as null_struct
"""


class TestBigQueryShowLimit(BaseShowLimit):
pass
Expand All @@ -40,7 +44,11 @@ class TestBigQueryShowSqlWorksWithJSONStruct:
def models(self):
return {
"json_struct_model.sql": model_with_json_struct,
"null_json_struct_model.sql": model_with_null_json_struct,
}

def test_sql_header(self, project):
run_dbt(["show", "--select", "json_struct_model"])

def test_show_with_null_json_struct(self, project):
run_dbt(["show", "--select", "null_json_struct_model"])

0 comments on commit 1a3917a

Please sign in to comment.