Skip to content

Commit

Permalink
Support agate Integer type, test with empty seed (#1004) (#1005)
Browse files Browse the repository at this point in the history
(cherry picked from commit 548d532)

Co-authored-by: Gerda Shank <[email protected]>
  • Loading branch information
github-actions[bot] and gshank authored Nov 7, 2023
1 parent 4de8f1a commit 05b221f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231107-100905.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Support agate Integer type, test with empty seed
time: 2023-11-07T10:09:05.723451-05:00
custom:
Author: gshank
Issue: "1003"
4 changes: 4 additions & 0 deletions dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ def convert_number_type(cls, agate_table: agate.Table, col_idx: int) -> str:
decimals = agate_table.aggregate(agate.MaxPrecision(col_idx)) # type: ignore[attr-defined]
return "float64" if decimals else "int64"

@classmethod
def convert_integer_type(cls, agate_table: agate.Table, col_idx: int) -> str:
return "int64"

@classmethod
def convert_boolean_type(cls, agate_table: agate.Table, col_idx: int) -> str:
return "bool"
Expand Down
5 changes: 5 additions & 0 deletions tests/functional/adapter/test_simple_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from dbt.tests.adapter.simple_seed.fixtures import macros__schema_test
from dbt.tests.adapter.simple_seed.seeds import seeds__enabled_in_config_csv, seeds__tricky_csv
from dbt.tests.adapter.simple_seed.test_seed import SeedConfigBase
from dbt.tests.adapter.simple_seed.test_seed import BaseTestEmptySeed
from dbt.tests.adapter.utils.base_utils import run_dbt


Expand Down Expand Up @@ -151,3 +152,7 @@ def test__bigquery_seed_table_with_labels_config_bigquery(self, project):
assert bq_table.labels
assert bq_table.labels == self.table_labels()
assert bq_table.expires


class TestBigQueryEmptySeed(BaseTestEmptySeed):
pass
3 changes: 3 additions & 0 deletions tests/unit/mock_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def convert_text_type(self, *args, **kwargs):
def convert_number_type(self, *args, **kwargs):
return self.responder.convert_number_type(*args, **kwargs)

def convert_integer_type(self, *args, **kwargs):
return self.responder.convert_integer_type(*args, **kwargs)

def convert_boolean_type(self, *args, **kwargs):
return self.responder.convert_boolean_type(*args, **kwargs)

Expand Down

0 comments on commit 05b221f

Please sign in to comment.