Skip to content

Commit 40c8044

Browse files
refactor: use elementary.is_tsql() instead of target.type checks
Replace all 'target.type in (fabric, sqlserver)' conditions with elementary.is_tsql() macro from dbt-data-reliability. Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent d566f90 commit 40c8044

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

elementary/monitor/dbt_project/macros/get_latest_invocation.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{% endif %}
88

99
{% set get_pkg_version_query %}
10-
{% if target.type in ('fabric', 'sqlserver') %}
10+
{% if elementary.is_tsql() %}
1111
select top 1 * from {{ invocations_relation }} order by generated_at desc
1212
{% else %}
1313
select * from {{ invocations_relation }} order by generated_at desc limit 1

elementary/monitor/dbt_project/macros/get_test_last_invocation.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
),
99

1010
test_invocation as (
11-
select {% if target.type in ('fabric', 'sqlserver') %}top 1{% endif %} distinct invocation_id, detected_at
11+
select {% if elementary.is_tsql() %}top 1{% endif %} distinct invocation_id, detected_at
1212
from elementary_test_results
1313
{% if invocation_id %}
1414
where invocation_id = {{ "'" ~ invocation_id ~ "'" }}
1515
{% elif invocation_max_time %}
1616
where detected_at < {{ "'" ~ invocation_max_time ~ "'" }}
1717
{% endif %}
1818
order by detected_at desc
19-
{% if target.type not in ('fabric', 'sqlserver') %}limit 1{% endif %}
19+
{% if not elementary.is_tsql() %}limit 1{% endif %}
2020
)
2121

2222
{% if invocations_relation %}

elementary/monitor/dbt_project/macros/test_conn.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% set elementary_database, elementary_schema = elementary.get_package_database_and_schema() %}
77
{% set elementary_model_relation = api.Relation.create(elementary_database, elementary_schema, "dbt_models") %}
88
{% set query %}
9-
{% if target.type in ('fabric', 'sqlserver') %}
9+
{% if elementary.is_tsql() %}
1010
select top 10 * from {{ elementary_model_relation }}
1111
{% else %}
1212
select * from {{ elementary_model_relation }} limit 10

elementary/monitor/dbt_project/macros/utils/edr_quote_identifier.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{%- macro edr_quote_identifier(identifier) -%}
2-
{%- if target.type in ('fabric', 'sqlserver') -%}
2+
{%- if elementary.is_tsql() -%}
33
[{{ identifier }}]
44
{%- else -%}
55
{{ identifier }}

0 commit comments

Comments
 (0)