Skip to content

get_catalog_relations passes unqualified schema names when custom schema prefix is used #682

@schakschak

Description

@schakschak

dbt-sqlserver version: 1.9.1 (works correctly on 1.9.0)

dbt-core version: 1.11.11

Database: SQL Server 2022

Problem:

When using a custom schema prefix in dbt_project.yml like this:

models:
  my_project:
    staging:
      +schema: stage
    raw_vault:
      +schema: raw_vault
The generate_schema_name macro correctly produces myproject_stage and myproject_raw_vault as the actual database schemas. But in 1.9.1, the Relation objects passed to get_catalog_relations have relation.schema = 'stage' instead of relation.schema = 'myproject_stage'. The catalog query therefore finds nothing and the catalog is written empty.

Bisect

1.9.0 works. 1.9.1 broke this. The only meaningful change between those releases is the removal of dbt-fabric as an upstream dependency (PR #628). Something in that dependency previously ensured Relation objects were constructed with the fully-generated schema name.

Sources are unaffected — their schema is their actual database schema and requires no prefix, so they resolve correctly.

Workaround

Pin to dbt-sqlserver==1.9.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions