Skip to content

Commit

Permalink
Update tests.sql
Browse files Browse the repository at this point in the history
Replace square brackets with double quotes and insert "." between schema and view in setting of testview.

Result was [dbo.testview_123] will now be "dbo"."testview_123"
  • Loading branch information
danakee authored Oct 7, 2024
1 parent ec30afe commit 7b4c56a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dbt/include/sqlserver/macros/materializations/tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
USE [{{ target.database }}];
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = '{{ target.schema }}')
BEGIN
EXEC('CREATE SCHEMA [{{ target.schema }}]')
EXEC('CREATE SCHEMA "{{ target.schema }}"')
END

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

{% set sql = main_sql.replace("'", "''")%}
Expand Down

0 comments on commit 7b4c56a

Please sign in to comment.