From 2a1e586fe3ce028ebd02974b3ba31554fd6b94e6 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Mon, 3 Oct 2022 22:22:44 -0700 Subject: [PATCH] remove current_timestamp macro and obsolete functional tests (#694) * Correct link from README to the CONTRIBUTING guide. (#687) * fix typo (#688) Co-authored-by: Alex Malins <22991362+alexmalins@users.noreply.github.com> * remove current_timestamp macro * add recency test back * fix recency * fix recency * update dev reqs * update dev reqs * fix recency.sql * fix recency * update dev-requirements * Fix copy paste error on TestTypeString * Remove specific branch reference for prerelease adapters * Delete obsolete functional tests * Remove functional test invocations from circle config * Remove references to retired macros in integration tests * Missed one * I msut save my files I must save my files I must save my files Co-authored-by: Liam O'Boyle Co-authored-by: Alex Malins Co-authored-by: Alex Malins <22991362+alexmalins@users.noreply.github.com> Co-authored-by: Joel Labes --- .circleci/config.yml | 12 -- README.md | 15 +- .../models/generic_tests/test_recency.sql | 6 +- .../models/geo/test_haversine_distance_km.sql | 2 +- .../models/geo/test_haversine_distance_mi.sql | 4 +- .../models/sql/test_get_column_values.sql | 2 +- .../sql/test_get_column_values_where.sql | 2 +- integration_tests/models/sql/test_groupby.sql | 4 +- .../models/sql/test_nullcheck_table.sql | 12 +- integration_tests/models/sql/test_unpivot.sql | 2 +- .../models/sql/test_unpivot_bool.sql | 2 +- .../test_get_column_values_use_default.sql | 6 +- macros/cross_db_utils/current_timestamp.sql | 40 ----- .../mutually_exclusive_ranges.sql | 2 +- macros/generic_tests/recency.sql | 2 +- tests/functional/cross_db_utils/test_utils.py | 140 ------------------ tests/functional/data_type/base_data_type.py | 46 ------ .../functional/data_type/test_type_bigint.py | 26 ---- tests/functional/data_type/test_type_float.py | 27 ---- tests/functional/data_type/test_type_int.py | 27 ---- .../functional/data_type/test_type_numeric.py | 49 ------ .../functional/data_type/test_type_string.py | 35 ----- .../data_type/test_type_timestamp.py | 31 ---- 23 files changed, 24 insertions(+), 470 deletions(-) delete mode 100644 macros/cross_db_utils/current_timestamp.sql delete mode 100644 tests/functional/cross_db_utils/test_utils.py delete mode 100644 tests/functional/data_type/base_data_type.py delete mode 100644 tests/functional/data_type/test_type_bigint.py delete mode 100644 tests/functional/data_type/test_type_float.py delete mode 100644 tests/functional/data_type/test_type_int.py delete mode 100644 tests/functional/data_type/test_type_numeric.py delete mode 100644 tests/functional/data_type/test_type_string.py delete mode 100644 tests/functional/data_type/test_type_timestamp.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 5c90e0a1..5c0daa61 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,9 +19,6 @@ jobs: steps: - checkout - run: pip install --pre dbt-postgres -r dev-requirements.txt - - run: - name: "Run Functional Tests - Postgres" - command: ./run_functional_test.sh postgres - run: name: "Run OG Tests - Postgres" command: ./run_test.sh postgres @@ -34,9 +31,6 @@ jobs: steps: - checkout - run: pip install --pre dbt-redshift -r dev-requirements.txt - - run: - name: "Run Functional Tests - Redshift" - command: ./run_functional_test.sh redshift - run: name: "Run OG Tests - Redshift" command: ./run_test.sh redshift @@ -49,9 +43,6 @@ jobs: steps: - checkout - run: pip install --pre dbt-snowflake -r dev-requirements.txt - - run: - name: "Run Functional Tests - Snowflake" - command: ./run_functional_test.sh snowflake - run: name: "Run OG Tests - Snowflake" command: ./run_test.sh snowflake @@ -69,9 +60,6 @@ jobs: - run: name: "Set up credentials" command: echo $BIGQUERY_SERVICE_ACCOUNT_JSON > ${HOME}/bigquery-service-key.json - - run: - name: "Run Functional Tests - BigQuery" - command: ./run_functional_test.sh bigquery - run: name: "Run OG Tests - BigQuery" command: ./run_test.sh bigquery diff --git a/README.md b/README.md index 3c9d46d7..9e47e071 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ Check [dbt Hub](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/) for the lates - [get_url_path](#get_url_path-source) - [Cross-database macros](#cross-database-macros): - - [current_timestamp](#current_timestamp-source) - [dateadd](#dateadd-source) - [datediff](#datediff-source) - [split_part](#split_part-source) @@ -1194,18 +1193,6 @@ Note that most of these macros moved to dbt Core as of dbt_utils v0.9.0 and dbt To access the version defined in dbt Core, remove the `dbt_utils.` prefix (see [https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros](https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros) for examples). As highlighted below, some of the cross-database macros are still in the process of being deprecated. -#### current_timestamp ([source](macros/cross_db_utils/current_timestamp.sql)) - -*DEPRECATED: This macro is deprecated and will be removed in a future version of the package, once equivalent functionality is implemented in dbt Core.* - -This macro returns the current timestamp. - -**Usage:** - -``` -{{ dbt_utils.current_timestamp() }} -``` - #### dateadd ([source](macros/cross_db_utils/dateadd.sql)) *DEPRECATED: This macro is now provided in dbt Core. It is no longer available in dbt_utils and backwards compatibility will be removed in a future version of the package.* @@ -1509,7 +1496,7 @@ A useful workaround is to change the above post-hook to: ### Reporting bugs and contributing code - Want to report a bug or request a feature? Let us know in the `#package-ecosystem` channel on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-utils/issues/new) -- Want to help us build dbt-utils? Check out the [Contributing Guide](https://github.com/dbt-utils/dbt-core/blob/HEAD/CONTRIBUTING.md) +- Want to help us build dbt-utils? Check out the [Contributing Guide](https://github.com/dbt-labs/dbt-utils/blob/main/CONTRIBUTING.md) - **TL;DR** Open a Pull Request with 1) your changes, 2) updated documentation for the `README.md` file, and 3) a working integration test. ---- diff --git a/integration_tests/models/generic_tests/test_recency.sql b/integration_tests/models/generic_tests/test_recency.sql index 9e245a3d..abede162 100644 --- a/integration_tests/models/generic_tests/test_recency.sql +++ b/integration_tests/models/generic_tests/test_recency.sql @@ -4,13 +4,13 @@ select 1 as col1, 2 as col2, - {{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as today + {{ date_trunc('day', current_timestamp()) }} as today {% else %} select 1 as col1, 2 as col2, - cast({{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as datetime) as today + cast({{ date_trunc('day', current_timestamp()) }} as datetime) as today -{% endif %} +{% endif %} \ No newline at end of file diff --git a/integration_tests/models/geo/test_haversine_distance_km.sql b/integration_tests/models/geo/test_haversine_distance_km.sql index e8ca4818..6a382922 100644 --- a/integration_tests/models/geo/test_haversine_distance_km.sql +++ b/integration_tests/models/geo/test_haversine_distance_km.sql @@ -13,7 +13,7 @@ final as ( lon2='lon_2', unit='km' ) - }} as {{ dbt_utils.type_numeric() }} + }} as {{ type_numeric() }} ) as actual from data ) diff --git a/integration_tests/models/geo/test_haversine_distance_mi.sql b/integration_tests/models/geo/test_haversine_distance_mi.sql index 53f8172c..9d6bc642 100644 --- a/integration_tests/models/geo/test_haversine_distance_mi.sql +++ b/integration_tests/models/geo/test_haversine_distance_mi.sql @@ -13,7 +13,7 @@ final as ( lon2='lon_2', unit='mi' ) - }} as {{ dbt_utils.type_numeric() }} + }} as {{ type_numeric() }} ) as actual from data @@ -29,7 +29,7 @@ final as ( lat2='lat_2', lon2='lon_2', ) - }} as {{ dbt_utils.type_numeric() }} + }} as {{ type_numeric() }} ) as actual from data ) diff --git a/integration_tests/models/sql/test_get_column_values.sql b/integration_tests/models/sql/test_get_column_values.sql index 36214984..fcfa1d8e 100644 --- a/integration_tests/models/sql/test_get_column_values.sql +++ b/integration_tests/models/sql/test_get_column_values.sql @@ -19,7 +19,7 @@ from {{ ref('data_get_column_values') }} select {% for val in column_values -%} - {{dbt_utils.safe_cast("sum(case when field = '" ~ val ~ "' then 1 else 0 end)", dbt_utils.type_string()) }} as count_{{ val }} + {{ safe_cast("sum(case when field = '" ~ val ~ "' then 1 else 0 end)", type_string()) }} as count_{{ val }} {%- if not loop.last %},{% endif -%} {%- endfor %} diff --git a/integration_tests/models/sql/test_get_column_values_where.sql b/integration_tests/models/sql/test_get_column_values_where.sql index a85a23aa..5eab9c9a 100644 --- a/integration_tests/models/sql/test_get_column_values_where.sql +++ b/integration_tests/models/sql/test_get_column_values_where.sql @@ -2,5 +2,5 @@ -- Create a relation using the values {% for val in column_values -%} -select {{ dbt_utils.string_literal(val) }} as field {% if not loop.last %}union all{% endif %} +select {{ string_literal(val) }} as field {% if not loop.last %}union all{% endif %} {% endfor %} \ No newline at end of file diff --git a/integration_tests/models/sql/test_groupby.sql b/integration_tests/models/sql/test_groupby.sql index 50a6ced7..fe790e96 100644 --- a/integration_tests/models/sql/test_groupby.sql +++ b/integration_tests/models/sql/test_groupby.sql @@ -2,8 +2,8 @@ with test_data as ( select - {{ dbt_utils.safe_cast("'a'", dbt_utils.type_string() )}} as column_1, - {{ dbt_utils.safe_cast("'b'", dbt_utils.type_string() )}} as column_2 + {{ safe_cast("'a'", type_string() )}} as column_1, + {{ safe_cast("'b'", type_string() )}} as column_2 ), diff --git a/integration_tests/models/sql/test_nullcheck_table.sql b/integration_tests/models/sql/test_nullcheck_table.sql index ea66c8ec..807b0f3c 100644 --- a/integration_tests/models/sql/test_nullcheck_table.sql +++ b/integration_tests/models/sql/test_nullcheck_table.sql @@ -24,16 +24,16 @@ from nulled select - {{ dbt_utils.safe_cast('field_1', - dbt_utils.type_string() + {{ safe_cast('field_1', + type_string() )}} as field_1, - {{ dbt_utils.safe_cast('field_2', - dbt_utils.type_string() + {{ safe_cast('field_2', + type_string() )}} as field_2, - {{ dbt_utils.safe_cast('field_3', - dbt_utils.type_string() + {{ safe_cast('field_3', + type_string() )}} as field_3 from nulled diff --git a/integration_tests/models/sql/test_unpivot.sql b/integration_tests/models/sql/test_unpivot.sql index 8cf1ad6e..17ea1e9b 100644 --- a/integration_tests/models/sql/test_unpivot.sql +++ b/integration_tests/models/sql/test_unpivot.sql @@ -24,7 +24,7 @@ select from ( {{ dbt_utils.unpivot( relation=ref('data_unpivot'), - cast_to=dbt_utils.type_string(), + cast_to=type_string(), exclude=exclude, remove=['name'], field_name='prop', diff --git a/integration_tests/models/sql/test_unpivot_bool.sql b/integration_tests/models/sql/test_unpivot_bool.sql index 26842c01..00c39df8 100644 --- a/integration_tests/models/sql/test_unpivot_bool.sql +++ b/integration_tests/models/sql/test_unpivot_bool.sql @@ -24,7 +24,7 @@ select from ( {{ dbt_utils.unpivot( relation=ref('data_unpivot_bool'), - cast_to=dbt_utils.type_string(), + cast_to=type_string(), exclude=exclude, field_name='prop', value_name='val' diff --git a/integration_tests/tests/sql/test_get_column_values_use_default.sql b/integration_tests/tests/sql/test_get_column_values_use_default.sql index 7f9fa3a4..95b551c3 100644 --- a/integration_tests/tests/sql/test_get_column_values_use_default.sql +++ b/integration_tests/tests/sql/test_get_column_values_use_default.sql @@ -2,14 +2,14 @@ {% set column_values = dbt_utils.get_column_values(ref('data_get_column_values_dropped'), 'field', default=['y', 'z'], order_by="field") %} with expected as ( - select {{ dbt_utils.safe_cast("'y'", dbt_utils.type_string()) }} as expected_column_value union all - select {{ dbt_utils.safe_cast("'z'", dbt_utils.type_string()) }} as expected_column_value + select {{ safe_cast("'y'", type_string()) }} as expected_column_value union all + select {{ safe_cast("'z'", type_string()) }} as expected_column_value ), actual as ( {% for val in column_values %} - select {{ dbt_utils.safe_cast("'" ~ val ~ "'", dbt_utils.type_string()) }} as actual_column_value + select {{ safe_cast("'" ~ val ~ "'", type_string()) }} as actual_column_value {% if not loop.last %} union all {% endif %} diff --git a/macros/cross_db_utils/current_timestamp.sql b/macros/cross_db_utils/current_timestamp.sql deleted file mode 100644 index 83ef2fd4..00000000 --- a/macros/cross_db_utils/current_timestamp.sql +++ /dev/null @@ -1,40 +0,0 @@ -{% macro current_timestamp() -%} - {% do dbt_utils.xdb_deprecation_warning_without_replacement('current_timestamp', model.package_name, model.name) %} - {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }} -{%- endmacro %} - -{% macro default__current_timestamp() %} - current_timestamp::{{ type_timestamp() }} -{% endmacro %} - -{% macro redshift__current_timestamp() %} - getdate() -{% endmacro %} - -{% macro bigquery__current_timestamp() %} - current_timestamp -{% endmacro %} - - - -{% macro current_timestamp_in_utc() -%} - {% do dbt_utils.xdb_deprecation_warning_without_replacement('current_timestamp_in_utc', model.package_name, model.name) %} - {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }} -{%- endmacro %} - -{% macro default__current_timestamp_in_utc() %} - {{ dbt_utils.current_timestamp() }} -{% endmacro %} - -{% macro snowflake__current_timestamp_in_utc() %} - convert_timezone('UTC', {{ dbt_utils.current_timestamp() }})::{{ type_timestamp() }} -{% endmacro %} - -{% macro postgres__current_timestamp_in_utc() %} - (current_timestamp at time zone 'utc')::{{ type_timestamp() }} -{% endmacro %} - -{# redshift should use default instead of postgres #} -{% macro redshift__current_timestamp_in_utc() %} - {{ return(dbt_utils.default__current_timestamp_in_utc()) }} -{% endmacro %} diff --git a/macros/generic_tests/mutually_exclusive_ranges.sql b/macros/generic_tests/mutually_exclusive_ranges.sql index b7545981..041788dd 100644 --- a/macros/generic_tests/mutually_exclusive_ranges.sql +++ b/macros/generic_tests/mutually_exclusive_ranges.sql @@ -56,7 +56,7 @@ with window_functions as ( calc as ( -- We want to return records where one of our assumptions fails, so we'll use - -- the `not` function with `and` statements so we can write our assumptions nore cleanly + -- the `not` function with `and` statements so we can write our assumptions more cleanly select *, diff --git a/macros/generic_tests/recency.sql b/macros/generic_tests/recency.sql index 85798748..98ed2ad5 100644 --- a/macros/generic_tests/recency.sql +++ b/macros/generic_tests/recency.sql @@ -4,7 +4,7 @@ {% macro default__test_recency(model, field, datepart, interval, group_by_columns) %} -{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %} +{% set threshold = dateadd(datepart, interval * -1, current_timestamp()) %} {% if group_by_columns|length() > 0 %} {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %} {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %} diff --git a/tests/functional/cross_db_utils/test_utils.py b/tests/functional/cross_db_utils/test_utils.py deleted file mode 100644 index 17eed66e..00000000 --- a/tests/functional/cross_db_utils/test_utils.py +++ /dev/null @@ -1,140 +0,0 @@ -import os -import pytest -from dbt.tests.util import run_dbt -from dbt.tests.adapter.utils.base_utils import BaseUtils -from dbt.tests.adapter.utils.test_any_value import BaseAnyValue -from dbt.tests.adapter.utils.test_bool_or import BaseBoolOr -from dbt.tests.adapter.utils.test_cast_bool_to_text import BaseCastBoolToText -from dbt.tests.adapter.utils.test_concat import BaseConcat -from dbt.tests.adapter.utils.test_dateadd import BaseDateAdd -from dbt.tests.adapter.utils.test_datediff import BaseDateDiff -from dbt.tests.adapter.utils.test_date_trunc import BaseDateTrunc -from dbt.tests.adapter.utils.test_escape_single_quotes import BaseEscapeSingleQuotesQuote -from dbt.tests.adapter.utils.test_escape_single_quotes import BaseEscapeSingleQuotesBackslash -from dbt.tests.adapter.utils.test_except import BaseExcept -from dbt.tests.adapter.utils.test_hash import BaseHash -from dbt.tests.adapter.utils.test_intersect import BaseIntersect -from dbt.tests.adapter.utils.test_last_day import BaseLastDay -from dbt.tests.adapter.utils.test_length import BaseLength -from dbt.tests.adapter.utils.test_listagg import BaseListagg -from dbt.tests.adapter.utils.test_position import BasePosition -from dbt.tests.adapter.utils.test_replace import BaseReplace -from dbt.tests.adapter.utils.test_right import BaseRight -from dbt.tests.adapter.utils.test_safe_cast import BaseSafeCast -from dbt.tests.adapter.utils.test_split_part import BaseSplitPart -from dbt.tests.adapter.utils.test_string_literal import BaseStringLiteral - - -class BaseDbtUtilsBackCompat(BaseUtils): - # install this repo as a package - @pytest.fixture(scope="class") - def packages(self): - return {"packages": [{"local": os.getcwd()}]} - - # call the macros from the 'dbt_utils' namespace - # instead of the unspecified / global namespace - def macro_namespace(self): - return "dbt_utils" - - # actual test sequence needs to run 'deps' first - def test_build_assert_equal(self, project): - run_dbt(['deps']) - super().test_build_assert_equal(project) - - -# order matters for this multiple inheritance: leftmost "wins" -# prioritize this package's macros -class TestAnyValue(BaseDbtUtilsBackCompat, BaseAnyValue): - pass - - -class TestBoolOr(BaseDbtUtilsBackCompat, BaseBoolOr): - pass - - -class TestCastBoolToText(BaseDbtUtilsBackCompat, BaseCastBoolToText): - pass - - -class TestConcat(BaseDbtUtilsBackCompat, BaseConcat): - pass - - -class TestDateAdd(BaseDbtUtilsBackCompat, BaseDateAdd): - pass - - -class TestDateDiff(BaseDbtUtilsBackCompat, BaseDateDiff): - pass - - -class TestDateTrunc(BaseDbtUtilsBackCompat, BaseDateTrunc): - pass - - -@pytest.mark.only_profile("postgres") -class TestEscapeSingleQuotesPostgres(BaseDbtUtilsBackCompat, BaseEscapeSingleQuotesQuote): - pass - - -@pytest.mark.only_profile("redshift") -class TestEscapeSingleQuotesRedshift(BaseDbtUtilsBackCompat, BaseEscapeSingleQuotesQuote): - pass - - -@pytest.mark.only_profile("snowflake") -class TestEscapeSingleQuotesSnowflake(BaseDbtUtilsBackCompat, BaseEscapeSingleQuotesBackslash): - pass - - -@pytest.mark.only_profile("bigquery") -class TestEscapeSingleQuotesBigQuery(BaseDbtUtilsBackCompat, BaseEscapeSingleQuotesBackslash): - pass - - -class TestExcept(BaseDbtUtilsBackCompat, BaseExcept): - pass - - -class TestHash(BaseDbtUtilsBackCompat, BaseHash): - pass - - -class TestIntersect(BaseDbtUtilsBackCompat, BaseIntersect): - pass - - -class TestLastDay(BaseDbtUtilsBackCompat, BaseLastDay): - pass - - -class TestLength(BaseDbtUtilsBackCompat, BaseLength): - pass - - -class TestListagg(BaseDbtUtilsBackCompat, BaseListagg): - pass - - -class TestPosition(BaseDbtUtilsBackCompat, BasePosition): - pass - - -class TestReplace(BaseDbtUtilsBackCompat, BaseReplace): - pass - - -class TestRight(BaseDbtUtilsBackCompat, BaseRight): - pass - - -class TestSafeCast(BaseDbtUtilsBackCompat, BaseSafeCast): - pass - - -class TestSplitPart(BaseDbtUtilsBackCompat, BaseSplitPart): - pass - - -class TestStringLiteral(BaseDbtUtilsBackCompat, BaseStringLiteral): - pass diff --git a/tests/functional/data_type/base_data_type.py b/tests/functional/data_type/base_data_type.py deleted file mode 100644 index 5bd0ceaa..00000000 --- a/tests/functional/data_type/base_data_type.py +++ /dev/null @@ -1,46 +0,0 @@ -import os -import pytest -from dbt.tests.util import run_dbt, check_relations_equal, get_relation_columns -from dbt.tests.adapter.utils.data_types.base_data_type_macro import BaseDataTypeMacro - -class BaseDbtUtilsBackCompat(BaseDataTypeMacro): - # install this repo as a package - @pytest.fixture(scope="class") - def packages(self): - return {"packages": [{"local": os.getcwd()}]} - - # call the macros from the 'dbt_utils' namespace - # instead of the unspecified / global namespace - def macro_namespace(self): - return "dbt_utils" - - # actual test sequence needs to run 'deps' first - def test_check_types_assert_match(self, project): - run_dbt(['deps']) - super().test_check_types_assert_match(project) - - -class BaseLegacyDataTypeMacro(BaseDbtUtilsBackCompat): - def assert_columns_equal(self, project, expected_cols, actual_cols): - # we need to be a little more lenient when mapping between 'legacy' and 'new' types that are equivalent - # e.g. 'character varying' and 'text' - if expected_cols == actual_cols: - # cool, no need for jank - pass - else: - # this is pretty janky - # our goal here: reasonable confidence that the switch from the legacy version of the dbt_utils.type_{X} macro, - # and the new version, will not constitute a breaking change for end users - for (expected_col, actual_col) in zip(expected_cols, actual_cols): - expected = project.adapter.Column(*expected_col) - actual = project.adapter.Column(*actual_col) - print(f"Subtle type difference detected: {expected.data_type} vs. {actual.data_type}") - if any(( - expected.is_string() and actual.is_string(), - expected.is_float() and actual.is_float(), - expected.is_integer() and actual.is_integer(), - expected.is_numeric() and actual.is_numeric(), - )): - pytest.xfail() - else: - pytest.fail() diff --git a/tests/functional/data_type/test_type_bigint.py b/tests/functional/data_type/test_type_bigint.py deleted file mode 100644 index f1f54742..00000000 --- a/tests/functional/data_type/test_type_bigint.py +++ /dev/null @@ -1,26 +0,0 @@ -import pytest -from tests.functional.data_type.base_data_type import BaseDbtUtilsBackCompat, BaseLegacyDataTypeMacro -from dbt.tests.adapter.utils.data_types.test_type_bigint import BaseTypeBigInt - - -class TestTypeBigInt(BaseDbtUtilsBackCompat, BaseTypeBigInt): - pass - - -# previous dbt_utils code -macros__legacy_sql = """ -{% macro default__type_bigint() %} - bigint -{% endmacro %} - -{% macro bigquery__type_bigint() %} - int64 -{% endmacro %} -""" - -class TestTypeBigIntLegacy(BaseLegacyDataTypeMacro, BaseTypeBigInt): - @pytest.fixture(scope="class") - def macros(self): - return { - "legacy.sql": macros__legacy_sql - } diff --git a/tests/functional/data_type/test_type_float.py b/tests/functional/data_type/test_type_float.py deleted file mode 100644 index 8afd68e0..00000000 --- a/tests/functional/data_type/test_type_float.py +++ /dev/null @@ -1,27 +0,0 @@ -import pytest -from tests.functional.data_type.base_data_type import BaseDbtUtilsBackCompat, BaseLegacyDataTypeMacro -from dbt.tests.adapter.utils.data_types.test_type_float import BaseTypeFloat - - -class TestTypeFloat(BaseDbtUtilsBackCompat, BaseTypeFloat): - pass - - -# previous dbt_utils code -macros__legacy_sql = """ -{% macro default__type_float() %} - float -{% endmacro %} - -{% macro bigquery__type_float() %} - float64 -{% endmacro %} -""" - - -class TestTypeFloatLegacy(BaseLegacyDataTypeMacro, BaseTypeFloat): - @pytest.fixture(scope="class") - def macros(self): - return { - "legacy.sql": macros__legacy_sql - } diff --git a/tests/functional/data_type/test_type_int.py b/tests/functional/data_type/test_type_int.py deleted file mode 100644 index 97e74c41..00000000 --- a/tests/functional/data_type/test_type_int.py +++ /dev/null @@ -1,27 +0,0 @@ -import pytest -from tests.functional.data_type.base_data_type import BaseDbtUtilsBackCompat, BaseLegacyDataTypeMacro -from dbt.tests.adapter.utils.data_types.test_type_int import BaseTypeInt - - -class TestTypeInt(BaseDbtUtilsBackCompat, BaseTypeInt): - pass - - -# previous dbt_utils code -macros__legacy_sql = """ -{% macro default__type_int() %} - int -{% endmacro %} - -{% macro bigquery__type_int() %} - int64 -{% endmacro %} -""" - - -class TestTypeFloatLegacy(BaseLegacyDataTypeMacro, BaseTypeInt): - @pytest.fixture(scope="class") - def macros(self): - return { - "legacy.sql": macros__legacy_sql - } diff --git a/tests/functional/data_type/test_type_numeric.py b/tests/functional/data_type/test_type_numeric.py deleted file mode 100644 index ebbc4db3..00000000 --- a/tests/functional/data_type/test_type_numeric.py +++ /dev/null @@ -1,49 +0,0 @@ -import pytest -from tests.functional.data_type.base_data_type import BaseDbtUtilsBackCompat, BaseLegacyDataTypeMacro -from dbt.tests.adapter.utils.data_types.test_type_numeric import BaseTypeNumeric - - -@pytest.mark.skip_profile('bigquery') -class TestTypeNumeric(BaseDbtUtilsBackCompat, BaseTypeNumeric): - pass - - -@pytest.mark.only_profile('bigquery') -class TestBigQueryTypeNumeric(BaseDbtUtilsBackCompat, BaseTypeNumeric): - def numeric_fixture_type(self): - return "numeric" - - -# previous dbt_utils code -macros__legacy_sql = """ -{% macro default__type_numeric() %} - numeric(28, 6) -{% endmacro %} -{% macro bigquery__type_numeric() %} - numeric -{% endmacro %} -""" - - -class BaseTypeNumericLegacy(BaseLegacyDataTypeMacro, BaseTypeNumeric): - @pytest.fixture(scope="class") - def macros(self): - return { - "legacy.sql": macros__legacy_sql - } - - -@pytest.mark.skip_profile('bigquery') -class TestTypeNumeric(BaseTypeNumeric): - pass - - -@pytest.mark.skip_profile('bigquery') -class TestTypeNumericLegacy(BaseTypeNumericLegacy): - pass - - -@pytest.mark.only_profile('bigquery') -class TestBigQueryTypeNumericLegacy(BaseTypeNumericLegacy): - def numeric_fixture_type(self): - return "numeric" diff --git a/tests/functional/data_type/test_type_string.py b/tests/functional/data_type/test_type_string.py deleted file mode 100644 index 64b2b81e..00000000 --- a/tests/functional/data_type/test_type_string.py +++ /dev/null @@ -1,35 +0,0 @@ -import pytest -from tests.functional.data_type.base_data_type import BaseDbtUtilsBackCompat, BaseLegacyDataTypeMacro -from dbt.tests.adapter.utils.data_types.test_type_string import BaseTypeString - - -class TestTypeInt(BaseDbtUtilsBackCompat, BaseTypeString): - pass - - -# previous dbt_utils code -macros__legacy_sql = """ -{% macro default__type_string() %} - string -{% endmacro %} - -{%- macro redshift__type_string() -%} - varchar -{%- endmacro -%} - -{% macro postgres__type_string() %} - varchar -{% endmacro %} - -{% macro snowflake__type_string() %} - varchar -{% endmacro %} -""" - - -class TestTypeStringLegacy(BaseLegacyDataTypeMacro, BaseTypeString): - @pytest.fixture(scope="class") - def macros(self): - return { - "legacy.sql": macros__legacy_sql - } diff --git a/tests/functional/data_type/test_type_timestamp.py b/tests/functional/data_type/test_type_timestamp.py deleted file mode 100644 index da87ce4b..00000000 --- a/tests/functional/data_type/test_type_timestamp.py +++ /dev/null @@ -1,31 +0,0 @@ -import pytest -from tests.functional.data_type.base_data_type import BaseDbtUtilsBackCompat, BaseLegacyDataTypeMacro -from dbt.tests.adapter.utils.data_types.test_type_timestamp import BaseTypeTimestamp - - -class TestTypeTimestamp(BaseDbtUtilsBackCompat, BaseTypeTimestamp): - pass - - -# previous dbt_utils code -macros__legacy_sql = """ -{% macro default__type_timestamp() %} - timestamp -{% endmacro %} - -{% macro postgres__type_timestamp() %} - timestamp without time zone -{% endmacro %} - -{% macro snowflake__type_timestamp() %} - timestamp_ntz -{% endmacro %} -""" - - -class TestTypeTimestampLegacy(BaseLegacyDataTypeMacro, BaseTypeTimestamp): - @pytest.fixture(scope="class") - def macros(self): - return { - "legacy.sql": macros__legacy_sql - }