dbt docs has extra, incorrect column names when model name and schema match a source table #1708
Closed
1 of 5 tasks
Labels
Milestone
Describe the bug
The model documentation generated by dbt is sometimes inaccurate and includes additional columns that aren't actually present in the table/view.
Steps To Reproduce
Define a dbt source. Create a model and configure it to use a target schema and alias that match one of the tables from your source (or you can make the model name the same as your source table rather than using an alias). Build the model, run
dbt compile
,dbt docs generate
, anddbt docs serve
. The model's documentation will include the columns from the model as well as the columns from the source. The source documentation will also include columns from the model.Expected behavior
The model documentation should only include the columns from that model itself.
dbt seems to expect that every "schema"."table" relation is unique. For example, you will get a compilation error if you have two models configured as follows:
model 1:
model 2:
dbt will not throw a compilation error, however, if a model is configured with the same "schema"."table" relation as a dbt source (but in a different database, of course).
dbt should either not allow configuring a model to have the same "schema"."table" as a source, or it should include database name in its expectation of relation uniqueness. The latter seems preferable if the goal is for dbt projects to be usable across multiple logical databases (e.g., with Snowflake).
Screenshots and log output
Source schema.yml and model .sql
Generated documentation for model (should only have
LONELY_COL
)Generated documentation for source (should not have
LONELY_COL
)System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
macOS Mojave
The output of
python --version
:2.7.10
The text was updated successfully, but these errors were encountered: