-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating dev requirements and requirements to run dbt-synapse adapter
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
dbt/include/synapse/macros/materializations/tests/helpers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% macro synapse__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%} | ||
|
||
-- Create target schema in synapse db if it does not | ||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = '{{ target.schema }}') | ||
BEGIN | ||
EXEC('CREATE SCHEMA [{{ target.schema }}]') | ||
END | ||
|
||
{% if main_sql.strip().lower().startswith('with') %} | ||
{% set testview %} | ||
{{ target.schema }}.testview_{{ range(1300, 19000) | random }} | ||
{% endset %} | ||
|
||
{% set sql = main_sql.replace("'", "''")%} | ||
EXEC('create view {{testview}} as {{ sql }};') | ||
select | ||
{{ "top (" ~ limit ~ ')' if limit != none }} | ||
{{ fail_calc }} as failures, | ||
case when {{ fail_calc }} {{ warn_if }} | ||
then 'true' else 'false' end as should_warn, | ||
case when {{ fail_calc }} {{ error_if }} | ||
then 'true' else 'false' end as should_error | ||
from ( | ||
select * from {{testview}} | ||
) dbt_internal_test; | ||
|
||
EXEC('drop view {{testview}};') | ||
|
||
{% else -%} | ||
select | ||
{{ "top (" ~ limit ~ ')' if limit != none }} | ||
{{ fail_calc }} as failures, | ||
case when {{ fail_calc }} {{ warn_if }} | ||
then 'true' else 'false' end as should_warn, | ||
case when {{ fail_calc }} {{ error_if }} | ||
then 'true' else 'false' end as should_error | ||
from ( | ||
{{ main_sql }} | ||
) dbt_internal_test | ||
{%- endif -%} | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ git+https://github.com/dbt-labs/[email protected]#egg=dbt-core&subdirectory=co | |
git+https://github.com/dbt-labs/dbt-adapters.git | ||
git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter | ||
git+https://github.com/dbt-labs/dbt-common.git | ||
git+https://github.com/microsoft/[email protected] | ||
|
||
pytest==8.0.1 | ||
twine==5.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters