Is this a new bug in dbt-core?
Current Behavior
A schema configured on an individual source table is retained in the parsed configuration but is ignored when dbt constructs the relation returned by source().
The table-level configuration is present in the parsed manifest as config.schema: sa_das_sadb_ingest_mi, but the source relation uses the parent source schema, sa_das_sadb_ingest.
This prevents one logical source table from being switched between physical schemas without defining a second source or replacing source() with adapter-specific relation construction.
Expected Behavior
The table-level schema configuration should determine the physical relation returned by source() while preserving the existing logical source reference.
Expected relation:
"compile_db"."sa_das_sadb_ingest_mi"."STUDENT_ACADEMIC_UNIT"
The downstream model should continue to use:
{{ source("sadb", "STUDENT_ACADEMIC_UNIT") }}
### Steps To Reproduce
1. Create a dbt project with dbt-core 1.11.7 and define a project variable in `dbt_project.yml`:
```yaml
vars:
sadb_schema_student_academic_unit: sa_das_sadb_ingest_mi
-
Define a source in models/ingest/_sadb__soursadb.yml:
version: 2
sources:
- name: sadb
schema: sa_das_sadb_ingest
tables:
- name: STUDENT_ACADEMIC_UNIT
config:
schema: "{{ var('sadb_schema_student_academic_unit', 'sa_das_sadb_ingest') }}"
-
Create a model that references the source:
select *
from {{ source("sadb", "STUDENT_ACADEMIC_UNIT") }}
-
Run dbt parse and inspect the source node in target/manifest.json.
-
Compare the config.schema value with the source node's relation_name and schema values.
Relevant log output
The parsed manifest contains the following source node values:
{
"relation_name": "\"compile_db\".\"sa_das_sadb_ingest\".\"STUDENT_ACADEMIC_UNIT\"",
"database": "compile_db",
"schema": "sa_das_sadb_ingest",
"identifier": "STUDENT_ACADEMIC_UNIT",
"config": {
"schema": "sa_das_sadb_ingest_mi"
}
}
The relevant source node is:
source.bdp_student_academics_das.sadb.STUDENT_ACADEMIC_UNIT
The manifest demonstrates that dbt retains the table-level configuration but does not use it when constructing
`relation_name`.
Environment
- OS: macOS
- Python: 3.13.5
- dbt-core: 1.11.7
- dbt command used for verification: `dbt parse --no-partial-parse --write-json`
Which database adapter are you using with dbt?
postgres
Additional Context
The current workaround uses adapter.get_relation() with the variable-defined schema:
{{ adapter.get_relation(
database=target.database,
schema=var('sadb_schema_student_academic_unit', 'sa_das_sadb_ingest'),
identifier='STUDENT_ACADEMIC_UNIT'
) }}
This workaround has two disadvantages:
- It is adapter-specific and performs a relation lookup that requires a live warehouse connection during compilation.
- It does not create the normal dbt source dependency and therefore does not provide equivalent source lineage or source freshness behavior.
The requested behavior is to support schema as a table-level source relation override, or to reject and validate the unsupported configuration instead of silently retaining it in config while ignoring it during relation construction.
Related issue: dbt-core #13705: Support macros or generate_database/schema_name in source configurations.
Is this a new bug in dbt-core?
Current Behavior
A schema configured on an individual source table is retained in the parsed configuration but is ignored when dbt constructs the relation returned by
source().The table-level configuration is present in the parsed manifest as
config.schema: sa_das_sadb_ingest_mi, but the source relation uses the parent source schema,sa_das_sadb_ingest.This prevents one logical source table from being switched between physical schemas without defining a second source or replacing
source()with adapter-specific relation construction.Expected Behavior
The table-level schema configuration should determine the physical relation returned by
source()while preserving the existing logical source reference.Expected relation:
The downstream model should continue to use:
{{ source("sadb", "STUDENT_ACADEMIC_UNIT") }} ### Steps To Reproduce 1. Create a dbt project with dbt-core 1.11.7 and define a project variable in `dbt_project.yml`: ```yaml vars: sadb_schema_student_academic_unit: sa_das_sadb_ingest_miDefine a source in
models/ingest/_sadb__soursadb.yml:Create a model that references the source:
Run
dbt parseand inspect the source node intarget/manifest.json.Compare the
config.schemavalue with the source node'srelation_nameandschemavalues.Relevant log output
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
The current workaround uses
adapter.get_relation()with the variable-defined schema:{{ adapter.get_relation( database=target.database, schema=var('sadb_schema_student_academic_unit', 'sa_das_sadb_ingest'), identifier='STUDENT_ACADEMIC_UNIT' ) }}This workaround has two disadvantages:
The requested behavior is to support
schemaas a table-level source relation override, or to reject and validate the unsupported configuration instead of silently retaining it inconfigwhile ignoring it during relation construction.Related issue: dbt-core #13705: Support macros or
generate_database/schema_namein source configurations.