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

Test repro case for delimiter issue #1372

Closed
wants to merge 4 commits into from
Closed
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
65 changes: 62 additions & 3 deletions tests/functional/adapter/test_simple_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
2,b
""".lstrip()

_SEED_CONFIGS_PIPE = """
seed_id|stuff
1|a
2|b
""".lstrip()

_SCHEMA_YML = """
version: 2
seeds:
Expand Down Expand Up @@ -66,6 +72,19 @@
labels:
contains_pii: 'yes'
contains_pie: 'no'

- name: seed_with_pipe
columns:
- name: seed_id
tests:
- column_type:
type: INT64
- name: stuff
tests:
- column_type:
type: STRING
config:
delimiter: '|'
""".lstrip()


Expand All @@ -80,6 +99,42 @@ def seeds(self):
"seed_enabled.csv": seeds__enabled_in_config_csv,
"seed_tricky.csv": seeds__tricky_csv,
"seed_configs.csv": _SEED_CONFIGS_CSV,
"seed_with_pipe.csv": _SEED_CONFIGS_PIPE,
}

@pytest.fixture(scope="class")
def macros(self):
return {
"schema_test.sql": macros__schema_test,
}

@pytest.fixture(scope="class")
def models(self):
return {"schema.yml": _SCHEMA_YML}

@staticmethod
def table_labels():
return {"contains_pii": "yes", "contains_pie": "no"}

def test__bigquery_simple_seed_with_schema_config_bigquery(self, project):
seed_results = run_dbt(["seed"])
assert len(seed_results) == 4
test_results = run_dbt(["test"])
assert len(test_results) == 10


class TestSimpleSeedProjectConfigs(SeedConfigBase):
@pytest.fixture(scope="class")
def schema(self):
return "simple_seed"

@pytest.fixture(scope="class")
def seeds(self):
return {
"seed_enabled.csv": seeds__enabled_in_config_csv,
"seed_tricky.csv": seeds__tricky_csv,
"seed_configs.csv": _SEED_CONFIGS_CSV,
"seed_with_pipe.csv": _SEED_CONFIGS_PIPE,
}

@pytest.fixture(scope="class")
Expand Down Expand Up @@ -111,6 +166,10 @@ def project_config_update(self):
"seed_configs": {
"enabled": True,
},
"seed_with_pipe": {
"enabled": True,
"+delimiter": "|",
},
},
},
}
Expand All @@ -136,13 +195,13 @@ def table_labels():

def test__bigquery_simple_seed_with_column_override_bigquery(self, project):
seed_results = run_dbt(["seed"])
assert len(seed_results) == 3
assert len(seed_results) == 4
test_results = run_dbt(["test"])
assert len(test_results) == 10
assert len(test_results) == 12

def test__bigquery_seed_table_with_labels_config_bigquery(self, project):
seed_results = run_dbt(["seed"])
assert len(seed_results) == 3
assert len(seed_results) == 4
with project.adapter.connection_named("_test"):
client = project.adapter.connections.get_thread_connection().handle
table_id = "{}.{}.{}".format(project.database, project.test_schema, "seed_configs")
Expand Down
Loading