Skip to content
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

Support agate Integer type, test with empty seed #1004

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading