Skip to content

Commit

Permalink
Revert "[backport] 1.7 #230 [bug] disable --limit on show (again)"
Browse files Browse the repository at this point in the history
  • Loading branch information
dataders authored Apr 15, 2024
1 parent 3f7d0af commit f9b4214
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
20 changes: 15 additions & 5 deletions dbt/include/synapse/macros/adapters/show.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{% macro get_show_sql(compiled_code, sql_header, limit) -%}
{%- if sql_header -%}
{{ sql_header }}
{%- endif -%}
{%- if limit is not none -%}
{%- set warn = "--limit is ignored. Synapse doesn't support the implementation" -%}
{{ log(warn, info=True) }}
{%- endif -%}
{{ compiled_code }}

{% endmacro %}

{% macro get_limit_subquery_sql(sql, limit) %}
{{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}
{% endmacro %}

{# Synapse doesnt support ANSI LIMIT clause #}
{% macro synapse__get_limit_subquery_sql(sql, limit) %}
{%- set warn = "-- limit of " ~ limit ~ " is ignored. Synapse doesn't support the implementation" -%}

{{ warn }}
{{ sql }}

select top {{ limit }} *
from (
{{ sql }}
) as model_limit_subq
{% endmacro %}
5 changes: 2 additions & 3 deletions tests/functional/adapter/test_dbt_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ class TestShowSqlHeaderSynapse(BaseShowSqlHeader):
pass


# Disabled because dbt-synapse doesn't support the `--limit` flag
# class TestShowLimitSynapse(BaseShowLimit):
# pass
class TestShowLimitSynapse(BaseShowLimit):
pass

0 comments on commit f9b4214

Please sign in to comment.