Skip to content

[BUG] Fusion does not respect db/schema overrides when previewing unsaved models #887

@sophieml

Description

@sophieml

Describe the bug
If attempting to preview an unsaved model (in dbt Studio), Fusion attempts to query the default specified database/schema, ignoring any database and schema overrides.

error: dbt1014: [Snowflake] 002003 (02000): SQL compilation error: Schema '<default_db>.NONE' does not exist or not authorized.

What version of dbt Fusion is this bug in? (find out by running dbt --version)
preview.45

Is this a discrepancy between the dbt Fusion Engine and dbt Core? Check one.

  • YES
  • NO

To Reproduce
generate_schema_name.sql:

{% macro generate_schema_name(custom_schema_name, node) -%}
    {{ custom_schema_name | trim }}
{%- endmacro %}

yml config (set env var to appropriate prefix):
folder structure - models/stg/schema_name/model.sql

models:
  project_name:
    stg:
      +database: "{{ env_var('DB_PREFIX') }}_stg"
      schema_name:
        +schema: "SCHEMA_NAME"
        +materialized: table

edit a model and attempt to preview without saving, observe above error

Expected behavior
previewing unsaved models works

Operating System and CPU Type (please complete the following information):
dbt Studio

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions