Skip to content

Commit da2b8a9

Browse files
committed
Updating dev requirements and requirements to run dbt-synapse adapter
1 parent 75694f6 commit da2b8a9

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

dbt/include/synapse/macros/adapters/metadata.sql

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{%- macro synapse__get_use_database_sql(database) -%}
22
{%- endmacro -%}
33

4+
{%- macro default__get_use_database_sql(database) -%}
5+
{{ return('') }}
6+
{%- endmacro -%}
7+
48
{% macro synapse__list_schemas(database) %}
59
{% call statement('list_schemas', fetch_result=True, auto_begin=False) -%}
610
select name as [schema]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% macro synapse__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}
2+
3+
-- Create target schema in synapse db if it does not
4+
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = '{{ target.schema }}')
5+
BEGIN
6+
EXEC('CREATE SCHEMA [{{ target.schema }}]')
7+
END
8+
9+
{% if main_sql.strip().lower().startswith('with') %}
10+
{% set testview %}
11+
{{ target.schema }}.testview_{{ range(1300, 19000) | random }}
12+
{% endset %}
13+
14+
{% set sql = main_sql.replace("'", "''")%}
15+
EXEC('create view {{testview}} as {{ sql }};')
16+
select
17+
{{ "top (" ~ limit ~ ')' if limit != none }}
18+
{{ fail_calc }} as failures,
19+
case when {{ fail_calc }} {{ warn_if }}
20+
then 'true' else 'false' end as should_warn,
21+
case when {{ fail_calc }} {{ error_if }}
22+
then 'true' else 'false' end as should_error
23+
from (
24+
select * from {{testview}}
25+
) dbt_internal_test;
26+
27+
EXEC('drop view {{testview}};')
28+
29+
{% else -%}
30+
select
31+
{{ "top (" ~ limit ~ ')' if limit != none }}
32+
{{ fail_calc }} as failures,
33+
case when {{ fail_calc }} {{ warn_if }}
34+
then 'true' else 'false' end as should_warn,
35+
case when {{ fail_calc }} {{ error_if }}
36+
then 'true' else 'false' end as should_error
37+
from (
38+
{{ main_sql }}
39+
) dbt_internal_test
40+
{%- endif -%}
41+
{%- endmacro %}

dev_requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ git+https://github.com/dbt-labs/[email protected]#egg=dbt-core&subdirectory=co
44
git+https://github.com/dbt-labs/dbt-adapters.git
55
git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter
66
git+https://github.com/dbt-labs/dbt-common.git
7-
git+https://github.com/microsoft/[email protected]
87

98
pytest==8.0.1
109
twine==5.0.0

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"Sam Debruyn",
1717
]
1818
dbt_version = "1.8"
19-
#dbt_fabric_requirement = "dbt-fabric==1.8.4"
19+
dbt_fabric_requirement = "dbt-fabric==1.8.6"
2020
description = """An Azure Synapse adapter plugin for dbt"""
2121

2222
this_directory = os.path.abspath(os.path.dirname(__file__))
@@ -73,7 +73,7 @@ def run(self):
7373
url="https://github.com/dbt-msft/dbt-synapse",
7474
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
7575
include_package_data=True,
76-
#install_requires=[dbt_fabric_requirement],
76+
install_requires=[dbt_fabric_requirement],
7777
cmdclass={
7878
"verify": VerifyVersionCommand,
7979
},

0 commit comments

Comments
 (0)