Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Jan 14, 2023
1 parent 102ea4f commit 6716836
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 122 deletions.
90 changes: 0 additions & 90 deletions tests/adapter/dbt/tests/adapter/incremental/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,3 @@

#
# Properties
#
_PROPERTIES__SCHEMA = """
version: 2
models:
- name: model_a
columns:
- name: id
tags: [column_level_tag]
tests:
- unique
- name: incremental_ignore
columns:
- name: id
tags: [column_level_tag]
tests:
- unique
- name: incremental_ignore_target
columns:
- name: id
tags: [column_level_tag]
tests:
- unique
- name: incremental_append_new_columns
columns:
- name: id
tags: [column_level_tag]
tests:
- unique
- name: incremental_append_new_columns_target
columns:
- name: id
tags: [column_level_tag]
tests:
- unique
- name: incremental_sync_all_columns
columns:
- name: id
tags: [column_level_tag]
tests:
- unique
- name: incremental_sync_all_columns_target
columns:
- name: id
tags: [column_leveL_tag]
tests:
- unique
"""

#
# Models
#
Expand Down Expand Up @@ -361,35 +303,3 @@
from source_data
"""

#
# Tests
#

_TESTS__SELECT_FROM_INCREMENTAL_IGNORE = """
select * from {{ ref('incremental_ignore') }} where false
"""

_TESTS__SELECT_FROM_A = """
select * from {{ ref('model_a') }} where false
"""

_TESTS__SELECT_FROM_INCREMENTAL_APPEND_NEW_COLUMNS_TARGET = """
select * from {{ ref('incremental_append_new_columns_target') }} where false
"""

_TESTS__SELECT_FROM_INCREMENTAL_SYNC_ALL_COLUMNS = """
select * from {{ ref('incremental_sync_all_columns') }} where false
"""

_TESTS__SELECT_FROM_INCREMENTAL_SYNC_ALL_COLUMNS_TARGET = """
select * from {{ ref('incremental_sync_all_columns_target') }} where false
"""

_TESTS__SELECT_FROM_INCREMENTAL_IGNORE_TARGET = """
select * from {{ ref('incremental_ignore_target') }} where false
"""

_TESTS__SELECT_FROM_INCREMENTAL_APPEND_NEW_COLUMNS = """
select * from {{ ref('incremental_append_new_columns') }} where false
"""
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
)

from dbt.tests.adapter.incremental.fixtures import (
_PROPERTIES__SCHEMA,
_MODELS__INCREMENTAL_SYNC_REMOVE_ONLY,
_MODELS__INCREMENTAL_IGNORE,
_MODELS__INCREMENTAL_SYNC_REMOVE_ONLY_TARGET,
Expand All @@ -19,23 +18,10 @@
_MODELS__INCREMENTAL_APPEND_NEW_COLUMNS,
_MODELS__INCREMENTAL_SYNC_ALL_COLUMNS_TARGET,
_MODELS__INCREMENTAL_APPEND_NEW_COLUMNS_REMOVE_ONE_TARGET,
_TESTS__SELECT_FROM_INCREMENTAL_IGNORE,
_TESTS__SELECT_FROM_A,
_TESTS__SELECT_FROM_INCREMENTAL_APPEND_NEW_COLUMNS_TARGET,
_TESTS__SELECT_FROM_INCREMENTAL_SYNC_ALL_COLUMNS,
_TESTS__SELECT_FROM_INCREMENTAL_SYNC_ALL_COLUMNS_TARGET,
_TESTS__SELECT_FROM_INCREMENTAL_IGNORE_TARGET,
_TESTS__SELECT_FROM_INCREMENTAL_APPEND_NEW_COLUMNS,
)


class BaseIncrementalOnSchemaChange:
@pytest.fixture(scope="class")
def properties(self):
return {
"schema.yml": _PROPERTIES__SCHEMA,
}

class BaseIncrementalOnSchemaChangeSetup:
@pytest.fixture(scope="class")
def models(self):
return {
Expand All @@ -58,23 +44,6 @@ def models(self):
_MODELS__INCREMENTAL_APPEND_NEW_COLUMNS_REMOVE_ONE_TARGET,
}

@pytest.fixture(scope="class")
def tests(self):
return {
"select_from_incremental.sql": _TESTS__SELECT_FROM_INCREMENTAL_IGNORE,
"select_from_a.sql": _TESTS__SELECT_FROM_A,
"select_from_incremental_append_new_columns_target.sql":
_TESTS__SELECT_FROM_INCREMENTAL_APPEND_NEW_COLUMNS_TARGET,
"select_from_incremental_sync_all_columns.sql":
_TESTS__SELECT_FROM_INCREMENTAL_SYNC_ALL_COLUMNS,
"select_from_incremental_sync_all_columns_target.sql":
_TESTS__SELECT_FROM_INCREMENTAL_SYNC_ALL_COLUMNS_TARGET,
"select_from_incremental_ignore_target.sql":
_TESTS__SELECT_FROM_INCREMENTAL_IGNORE_TARGET,
"select_from_incremental_append_new_columns.sql":
_TESTS__SELECT_FROM_INCREMENTAL_APPEND_NEW_COLUMNS,
}

def run_twice_and_assert(
self, include, compare_source, compare_target, project
):
Expand Down Expand Up @@ -115,6 +84,8 @@ def run_incremental_sync_remove_only(self, project):
compare_target = 'incremental_sync_remove_only_target'
self.run_twice_and_assert(select, compare_source, compare_target, project)


class BaseIncrementalOnSchemaChange(BaseIncrementalOnSchemaChangeSetup):
def test_run_incremental_ignore(self, project):
select = 'model_a incremental_ignore incremental_ignore_target'
compare_source = 'incremental_ignore'
Expand Down

0 comments on commit 6716836

Please sign in to comment.