Skip to content

Commit

Permalink
Merge pull request #64 from dbt-msft/drop_unneeded_synapse_autodispat…
Browse files Browse the repository at this point in the history
…ches

deprecate manual synapse dispatches
  • Loading branch information
dataders authored Nov 12, 2021
2 parents 0b6a474 + 959d602 commit 1229168
Show file tree
Hide file tree
Showing 43 changed files with 0 additions and 326 deletions.
4 changes: 0 additions & 4 deletions integration_tests/dbt_date/macros/get_test_dates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
{{ return([49,49]) }}
{%- endmacro %}

{% macro synapse__get_test_week_of_year() -%}
{{ return(sqlserver__get_test_week_of_year()) }}
{%- endmacro %}

{% macro sqlserver__get_test_timestamps() -%}
{{ return(['2021-06-07 07:35:20.000000 -07:00',
'2021-06-07 14:35:20.000000 +00:00']) }}
Expand Down
4 changes: 0 additions & 4 deletions integration_tests/dbt_utils/macros/limit_zero.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{% macro sqlserver__limit_zero() %}
{{ return('where 0=1') }}
{% endmacro %}

{% macro synapse__limit_zero() -%}
{{ return(sqlserver__limit_zero()) }}
{%- endmacro %}
4 changes: 0 additions & 4 deletions macros/dbt_audit_helper/compare_column_values.sql
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ select
from aggregated

{% endmacro %}

{% macro synapse__compare_column_values(a_query, b_query, primary_key, column_to_compare) -%}
{% do return( tsql_utils.sqlserver__compare_column_values(a_query, b_query, primary_key, column_to_compare)) %}
{%- endmacro %}
5 changes: 0 additions & 5 deletions macros/dbt_audit_helper/compare_queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,3 @@ select
from summary_stats

{% endmacro %}


{% macro synapse__compare_queries(a_query, b_query, primary_key=None) -%}
{% do return( tsql_utils.sqlserver__compare_queries(a_query, b_query, primary_key=None)) %}
{%- endmacro %}
7 changes: 0 additions & 7 deletions macros/dbt_audit_helper/compare_relation_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ full outer join b_cols using (column_name)

{% endmacro %}

{% macro synapse__compare_relation_columns(a_relation, b_relation) -%}
{% do return( tsql_utils.sqlserver__compare_relation_columns(a_relation, b_relation)) %}
{%- endmacro %}

{% macro sqlserver__get_columns_in_relation_sql(relation) %}
SELECT
Expand Down Expand Up @@ -54,7 +51,3 @@ full outer join b_cols using (column_name)
from tempdb.INFORMATION_SCHEMA.COLUMNS
where table_name like '{{ relation.identifier }}%') cols
{% endmacro %}

{% macro synapse__get_columns_in_relation_sql(relation) -%}
{% do return( tsql_utils.sqlserver__get_columns_in_relation_sql(relation)) %}
{%- endmacro %}
4 changes: 0 additions & 4 deletions macros/dbt_audit_helper/compare_relations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,3 @@ from {{ b_relation }}
{{ tsql_utils.sqlserver__compare_queries(a_query, b_query, primary_key) }}

{% endmacro %}

{% macro synapse__compare_relations(a_relation, b_relation, exclude_columns=[], primary_key=None) -%}
{% do return( tsql_utils.sqlserver__compare_relations(a_relation, b_relation, exclude_columns=[], primary_key=None)) %}
{%- endmacro %}
5 changes: 0 additions & 5 deletions macros/dbt_date/calendar_date/convert_timezones.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{% macro sqlserver__convert_timezone(column, target_tz, source_tz) -%}
CAST({{ column }} as {{ dbt_utils.type_timestamp() }}) AT TIME ZONE '{{ source_tz }}' AT TIME ZONE '{{ target_tz }}'
{%- endmacro -%}
{# {{ column }} AT TIME ZONE '{{ target_tz }}' #}
{% macro synapse__convert_timezone(column, target_tz, source_tz) -%}
{% do return( tsql_utils.sqlserver__convert_timezone(column, target_tz, source_tz)) %}
{%- endmacro -%}

4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/date_part.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{% macro sqlserver__date_part(datepart, date) -%}
datepart({{ datepart }}, {{ date }})
{%- endmacro %}

{% macro synapse__date_part(datepart, date) -%}
{% do return( tsql_utils.sqlserver__date_part(datepart, date)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/day_name.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
{%- set f = 'ddd' if short else 'dddd' -%}
format({{ date }}, '{{ f }}')
{%- endmacro %}

{% macro synapse__day_name(date, short) -%}
{% do return( tsql_utils.sqlserver__day_name(date, short)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/day_of_week.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,3 @@
{%- endif -%}

{%- endmacro %}

{% macro synapse__day_of_week(date, isoweek) -%}
{% do return( tsql_utils.sqlserver__day_of_week(date, isoweek)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/from_unixtimestamp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@
dateadd({{ scale }}, {{ epochs }}, '1970-01-01')

{%- endmacro %}

{% macro synapse__from_unixtimestamp(epochs, format) -%}
{% do return( tsql_utils.sqlserver__from_unixtimestamp(epochs, format)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/iso_week_of_year.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{%- macro sqlserver__iso_week_of_year(date) -%}
cast({{ dbt_date.date_part('iso_week', date) }} as {{ dbt_utils.type_int() }})
{%- endmacro %}

{% macro synapse__iso_week_of_year(date) -%}
{% do return( tsql_utils.sqlserver__iso_week_of_year(date)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/iso_week_start.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{%- macro sqlserver__iso_week_start(date) -%}
cast(dateadd(week, datediff(week, 0, dateadd(day, -1, {{date}})), 0) as date)
{%- endmacro %}

{% macro synapse__iso_week_start(date) -%}
{% do return( tsql_utils.sqlserver__iso_week_start(date)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/month_name.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
{%- set f = 'MMM' if short else 'MMMM' -%}
format({{ date }}, '{{ f }}')
{%- endmacro %}

{% macro synapse__month_name(date, short) -%}
{% do return( tsql_utils.sqlserver__month_name(date, short)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/week_end.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
{%- set dt = dbt_date.week_start(date) -%}
{{ dbt_date.n_days_away(6, dt) }}
{%- endmacro %}

{% macro synapse__week_end(date) -%}
{% do return( tsql_utils.sqlserver__week_end(date)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/week_of_year.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{%- macro sqlserver__week_of_year(date) -%}
cast({{ dbt_date.date_part('week', date)}} as {{ dbt_utils.type_int() }})
{%- endmacro %}

{% macro synapse__week_of_year(date) -%}
{% do return( tsql_utils.sqlserver__week_of_year(date)) %}
{%- endmacro -%}
4 changes: 0 additions & 4 deletions macros/dbt_date/calendar_date/week_start.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
-- Sunday as week start date
cast({{ dbt_utils.dateadd('day', -1, dbt_utils.date_trunc('week', dbt_utils.dateadd('day', 1, date))) }} as date)
{%- endmacro %}

{% macro synapse__week_start(date) -%}
{% do return( tsql_utils.sqlserver__week_start(date)) %}
{%- endmacro -%}
5 changes: 0 additions & 5 deletions macros/dbt_expectations/math/log_natural.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@
log({{ x }})

{%- endmacro -%}


{% macro synapse__log_natural(x) -%}
{% do return( tsql_utils.sqlserver__log_natural(x)) %}
{%- endmacro -%}
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,3 @@
expression_difference > {{ tolerance }}
{% endif %}
{%- endmacro -%}

{%- macro synapse__test_equal_expression(model, expression,
compare_model,
compare_expression,
group_by,
compare_group_by,
row_condition,
compare_row_condition,
tolerance,
tolerance_percent,
return_difference) -%}
{% do return( tsql_utils.sqlserver__test_equal_expression(model, expression,
compare_model,
compare_expression,
group_by,
compare_group_by,
row_condition,
compare_row_condition,
tolerance,
tolerance_percent,
return_difference)) -%}
{%- endmacro -%}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,3 @@ select count(*)
from validation_errors

{% endmacro %}

{% macro synapse__expression_is_true(model, expression, test_condition, group_by_columns, row_condition) %}
{% do return( tsql_utils.sqlserver__expression_is_true(model, expression, test_condition, group_by_columns, row_condition)) %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,3 @@ select count(*) as validation_errors
from validation_errors

{% endmacro %}

{% macro synapse__test_expect_column_most_common_value_to_be_in_set(model, column_name,
value_set,
top_n,
quote_values,
data_type,
row_condition
) -%}
{% do return( tsql_utils.sqlserver__test_expect_column_most_common_value_to_be_in_set(model, column_name,
value_set,
top_n,
quote_values=False,
data_type="decimal",
row_condition=None
)) -%}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,3 @@ stdev({{ column_name }})
row_condition=row_condition
) }}
{% endmacro %}

{% macro synapse__test_expect_column_stdev_to_be_between(model, column_name,
min_value,
max_value,
group_by,
row_condition
) -%}
{% do return( tsql_utils.sqlserver__test_expect_column_stdev_to_be_between(model, column_name,
min_value,
max_value,
group_by,
row_condition=None
)) -%}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,3 @@ where
)
{%- endmacro -%}


{% macro synapse__test_expect_column_values_to_be_within_n_moving_stdevs(model,
column_name,
date_column_name,
period,
lookback_periods,
trend_periods,
test_periods,
sigma_threshold,
sigma_threshold_upper,
sigma_threshold_lower,
take_diffs,
take_logs
) %}
{% do return( tsql_utils.sqlserver__test_expect_column_values_to_be_within_n_moving_stdevs(model,
column_name,
date_column_name,
period,
lookback_periods,
trend_periods,
test_periods,
sigma_threshold,
sigma_threshold_upper,
sigma_threshold_lower,
take_diffs,
take_logs
)) %}
{%- endmacro -%}
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,3 @@ from
where
abs({{ column_name }}_sigma) > {{ sigma_threshold }}
{%- endmacro %}


{% macro synapse__test_expect_column_values_to_be_within_n_stdevs(model,
column_name,
group_by,
sigma_threshold
) %}
{% do return( tsql_utils.sqlserver__test_expect_column_values_to_be_within_n_stdevs(model,
column_name,
group_by,
sigma_threshold
)) %}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,3 @@ validation_errors as (
)
select count(*) from validation_errors
{% endmacro %}

{% macro synapse__test_expect_select_column_values_to_be_unique_within_record(model,
column_list,
quote_columns,
ignore_row_if,
row_condition
) %}
{% do return( tsql_utils.sqlserver__test_expect_select_column_values_to_be_unique_within_record(model,
column_list,
quote_columns,
ignore_row_if,
row_condition
)) %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,3 @@ validation_errors as (
)
select count(*) from validation_errors
{% endmacro %}

{% macro synapse__test_expect_grouped_row_values_to_have_recent_data(model, group_by, timestamp_column, datepart, interval) %}
{% do return( tsql_utils.sqlserver__test_expect_grouped_row_values_to_have_recent_data(model, group_by, timestamp_column, datepart, interval)) %}
{% endmacro %}
4 changes: 0 additions & 4 deletions macros/dbt_utils/cross_db_utils/concat.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{% macro sqlserver__concat(fields) -%}
concat({{ fields|join(', ') }}, '')
{%- endmacro %}

{% macro synapse__concat(fields) -%}
{% do return( tsql_utils.sqlserver__concat(fields)) %}
{%- endmacro %}
8 changes: 0 additions & 8 deletions macros/dbt_utils/cross_db_utils/current_timestamp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
getdate()
{% endmacro %}

{% macro synapse__current_timestamp() %}
{% do return( tsql_utils.sqlserver__current_timestamp()) %}
{% endmacro %}

{% macro sqlserver__current_timestamp_in_utc() %}
getutcdate()
{% endmacro %}

{% macro synapse__current_timestamp_in_utc() %}
{% do return( tsql_utils.sqlserver__current_timestamp_in_utc()) %}
{% endmacro %}
17 changes: 0 additions & 17 deletions macros/dbt_utils/cross_db_utils/datatypes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,3 @@
{# https://docs.microsoft.com/en-us/sql/t-sql/functions/date-and-time-data-types-and-functions-transact-sql?view=sql-server-ver15#DateandTimeDataTypes #}
DATETIMEOFFSET
{% endmacro %}

{#
Imagine an adapter plugin, dbt-synapse, that inherits from dbt-sqlserver.
For the time being, we need to explicitly reimplement sqlserver__ macros
as synapse__ macros.

TODO: We can make a small change to dbt-core (https://github.com/fishtown-analytics/dbt/issues/2923)
that will make the inheritance of dispatched macros work just like the
inheritance of other adapter objects, and render the following code redundant.
#}
{% macro synapse__type_string() %}
{% do return( tsql_utils.sqlserver__type_string()) %}
{% endmacro %}

{% macro synapse__type_timestamp() %}
{% do return( tsql_utils.sqlserver__type_timestamp()) %}
{% endmacro %}
4 changes: 0 additions & 4 deletions macros/dbt_utils/cross_db_utils/date_trunc.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{% macro sqlserver__date_trunc(datepart, date) %}
CAST(DATEADD({{datepart}}, DATEDIFF({{datepart}}, 0, {{date}}), 0) AS DATE)
{% endmacro %}

{% macro synapse__date_trunc(datepart, date) %}
{% do return( tsql_utils.sqlserver__date_trunc(datepart, date)) %}
{% endmacro %}
4 changes: 0 additions & 4 deletions macros/dbt_utils/cross_db_utils/dateadd.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@
)

{% endmacro %}

{% macro synapse__dateadd(datepart, interval, from_date_or_timestamp) %}
{% do return( tsql_utils.sqlserver__dateadd(datepart, interval, from_date_or_timestamp)) %}
{% endmacro %}
Loading

0 comments on commit 1229168

Please sign in to comment.