Skip to content

Error on table materialization when using special schema name #619

@j-win-syn

Description

@j-win-syn

Similar problem to the resolved issue: #549

In the project.yml the quoting for the database, schema and identifier is set as following:

quoting:
database: true
schema: true
identifier: true

My model mytestmodel should be created in schema group

Following line ignores the setting for the quotation completly.
https://github.com/dbt-msft/dbt-sqlserver/blob/master/dbt/include/sqlserver/macros/relations/table/create.sql#L36
EXEC('DROP VIEW IF EXISTS {{tmp_relation.schema}}.{{tmp_relation.identifier}}')

The complied code looks like this:
EXEC('DROP VIEW IF EXISTS "group"."mytestmodel__dbt_tmp_vw"')

This code leads to the error:

Incorrect syntax near the keyword 'group'.

As a workaround overwritting the macro and replace the line with the following line works for me (but this doesn't consider the quoting setting from the project.yml):
EXEC('DROP VIEW IF EXISTS "{{tmp_relation.schema}}"."{{tmp_relation.identifier}}"')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions