Skip to content

Commit

Permalink
Merge pull request #576 from Benjamin-Knight/issue_575_test_view_coll…
Browse files Browse the repository at this point in the history
…isions

Update the derivation of the test view name
  • Loading branch information
cody-scott authored Jan 20, 2025
2 parents dde95d5 + aa37819 commit c217b30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dbt/include/sqlserver/macros/materializations/tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
END

{% set testview %}
[{{ target.schema }}.testview_{{ range(1300, 19000) | random }}]
[{{ target.schema }}].[testview_{{ local_md5(main_sql) }}_{{ range(1300, 19000) | random }}]
{% endset %}

{% set sql = main_sql.replace("'", "''")%}
Expand Down
4 changes: 2 additions & 2 deletions dbt/include/sqlserver/macros/materializations/unit_tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ EXEC('CREATE SCHEMA [{{ target.schema }}]')
END

{% set test_view %}
[{{ target.schema }}.testview_{{ range(1300, 19000) | random }}]
[{{ target.schema }}].[testview_{{ local_md5(main_sql) }}_{{ range(1300, 19000) | random }}]
{% endset %}
{% set test_sql = main_sql.replace("'", "''")%}
EXEC('create view {{test_view}} as {{ test_sql }};')

{% set expected_view %}
[{{ target.schema }}.expectedview_{{ range(1300, 19000) | random }}]
[{{ target.schema }}].[expectedview_{{ local_md5(expected_fixture_sql) }}_{{ range(1300, 19000) | random }}]
{% endset %}
{% set expected_sql = expected_fixture_sql.replace("'", "''")%}
EXEC('create view {{expected_view}} as {{ expected_sql }};')
Expand Down

0 comments on commit c217b30

Please sign in to comment.