diff --git a/core/dbt/deprecations.py b/core/dbt/deprecations.py index 25e27d3ab8a..855523b85e0 100644 --- a/core/dbt/deprecations.py +++ b/core/dbt/deprecations.py @@ -30,16 +30,6 @@ class DBTRepositoriesDeprecation(DBTDeprecation): """ -class SqlWhereDeprecation(DBTDeprecation): - name = "sql_where" - description = """\ -The `sql_where` option for incremental models is deprecated and will be - removed in a future release. Check the docs for more information - - {} - """.format(dbt.links.IncrementalDocs) - - class SeedDropExistingDeprecation(DBTDeprecation): name = 'drop-existing' description = """The --drop-existing argument to `dbt seed` has been @@ -83,7 +73,6 @@ def warn(name, *args, **kwargs): deprecations_list = [ DBTRepositoriesDeprecation(), SeedDropExistingDeprecation(), - SqlWhereDeprecation(), ] deprecations = {d.name: d for d in deprecations_list} diff --git a/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql b/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql index e0a3ce51e2a..f53df57cd4e 100644 --- a/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql +++ b/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql @@ -12,7 +12,6 @@ {%- endmacro %} {% materialization incremental, default -%} - {%- set sql_where = config.get('sql_where') -%} {%- set unique_key = config.get('unique_key') -%} {%- set identifier = model['alias'] -%} @@ -57,19 +56,7 @@ {%- else -%} {%- call statement() -%} - {% set tmp_table_sql -%} - {# We are using a subselect instead of a CTE here to allow PostgreSQL to use indexes. -#} - select * from ( - {{ sql }} - ) as dbt_incr_sbq - - {% if sql_where %} - where ({{ sql_where }}) - or ({{ sql_where }}) is null - {% endif %} - {%- endset %} - - {{ dbt.create_table_as(True, tmp_relation, tmp_table_sql) }} + {{ dbt.create_table_as(True, tmp_relation, sql) }} {%- endcall -%} diff --git a/core/dbt/loader.py b/core/dbt/loader.py index daa74d510c6..074e4bf26be 100644 --- a/core/dbt/loader.py +++ b/core/dbt/loader.py @@ -214,8 +214,6 @@ def _warn_for_unused_resource_config_paths(manifest, config): def _warn_for_deprecated_configs(manifest): for unique_id, node in manifest.nodes.items(): is_model = node.resource_type == NodeType.Model - if is_model and 'sql_where' in node.config: - deprecations.warn('sql_where') def _check_manifest(manifest, config): diff --git a/core/dbt/parser/source_config.py b/core/dbt/parser/source_config.py index fd5482a3c4c..bfaf99cec98 100644 --- a/core/dbt/parser/source_config.py +++ b/core/dbt/parser/source_config.py @@ -13,7 +13,6 @@ class SourceConfig(object): 'schema', 'enabled', 'materialized', - 'sql_where', 'unique_key', 'database', } diff --git a/plugins/bigquery/dbt/include/bigquery/macros/materializations/incremental.sql b/plugins/bigquery/dbt/include/bigquery/macros/materializations/incremental.sql index d561ea487c4..98c65a1dddc 100644 --- a/plugins/bigquery/dbt/include/bigquery/macros/materializations/incremental.sql +++ b/plugins/bigquery/dbt/include/bigquery/macros/materializations/incremental.sql @@ -2,7 +2,6 @@ {% materialization incremental, adapter='bigquery' -%} {%- set unique_key = config.get('unique_key') -%} - {%- set sql_where = config.get('sql_where') -%} {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%} {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%} @@ -34,12 +33,7 @@ {% set source_sql -%} {#-- wrap sql in parens to make it a subquery --#} ( - select * from ( - {{ sql }} - ) - {% if sql_where %} - where ({{ sql_where }}) or ({{ sql_where }}) is null - {% endif %} + {{ sql }} ) {%- endset -%} diff --git a/test/integration/012_deprecation_tests/models/sql_where.sql b/test/integration/012_deprecation_tests/models/sql_where.sql deleted file mode 100644 index 34ca3c36464..00000000000 --- a/test/integration/012_deprecation_tests/models/sql_where.sql +++ /dev/null @@ -1,3 +0,0 @@ -{{ config(sql_where='id > (select max(id) from {{this}})')}} - -select 1 as id diff --git a/test/integration/012_deprecation_tests/test_deprecations.py b/test/integration/012_deprecation_tests/test_deprecations.py index 2642d9acefb..9f9e3544019 100644 --- a/test/integration/012_deprecation_tests/test_deprecations.py +++ b/test/integration/012_deprecation_tests/test_deprecations.py @@ -29,6 +29,6 @@ def test_postgres_deprecations_fail(self): @use_profile('postgres') def test_postgres_deprecations(self): self.assertEqual(deprecations.active_deprecations, set()) - results = self.run_dbt(strict=False) - self.assertEqual({'adapter:already_exists', 'sql_where'}, + self.run_dbt(strict=False) + self.assertEqual({'adapter:already_exists'}, deprecations.active_deprecations) diff --git a/test/unit/test_config.py b/test/unit/test_config.py index ea6a9fd50f0..d35948696eb 100644 --- a/test/unit/test_config.py +++ b/test/unit/test_config.py @@ -42,7 +42,6 @@ def temp_cd(path): 'sort': 'timestamp', 'materialized': 'incremental', 'dist': 'user_id', - 'sql_where': 'created_at > (select max(created_at) from {{ this }})', 'unique_key': 'id' }, 'base': { diff --git a/test/unit/test_graph.py b/test/unit/test_graph.py index 37d2f1a7710..5d34c3d97d5 100644 --- a/test/unit/test_graph.py +++ b/test/unit/test_graph.py @@ -208,7 +208,6 @@ def test__model_incremental(self): "test_models_compile": { "model_one": { "materialized": "incremental", - "sql_where": "created_at", "unique_key": "id" }, }