Skip to content

Commit

Permalink
Merge pull request #235 from microsoft/fix_show_again
Browse files Browse the repository at this point in the history
[bug] disable `--limit` on `show` (again)
  • Loading branch information
prdpsvs committed Apr 15, 2024
2 parents 75e2621 + bc02d17 commit 8f4a6a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
20 changes: 5 additions & 15 deletions dbt/include/synapse/macros/adapters/show.sql
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
{% 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) %}
select top {{ limit }} *
from (
{{ sql }}
) as model_limit_subq
{%- set warn = "-- limit of " ~ limit ~ " is ignored. Synapse doesn't support the implementation" -%}

{{ warn }}
{{ sql }}

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


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

0 comments on commit 8f4a6a3

Please sign in to comment.