dbt-coverage icon indicating copy to clipboard operation
dbt-coverage copied to clipboard

Aliases mess up coverage

Open Mavtti opened this issue 2 years ago • 1 comments

Using aliases messes up the coverage.

In load_files the table name is not the same for catalog & manifest, as such when doing manifest.XXX.get(table_name, {}) it returns nothing.

This comes from the fact that in Table.from_node() the Table is initialized with the alias instead of the model name.

One simple solution would be to use the unique_id as identifier. It means:

  • changing Manifest.full_table_name to return table["unique_id"].lower()
  • changing Table.from_node to return Table(node["unique_id"], ...)

Mavtti avatar Jun 07 '22 14:06 Mavtti

Thanks for the suggestion @Mavtti!

@sweco I guess this is something worth thinking about for the future -- aliases are a pretty nice feature worth supporting 🙂

mrshu avatar Jul 30 '22 15:07 mrshu

@Mavtti I believe with the new release, we should be closer to this than ever. Would you be up for sending a quick PR that would refactor the behaviour of Table.from_node()?

Thanks!

mrshu avatar Nov 17 '22 17:11 mrshu