Skip to content

Commit

Permalink
Fix generic tests returning "TypeError: 'NoneType' object is not subs…
Browse files Browse the repository at this point in the history
…criptable" (#1)

Generic tests return an error "TypeError: 'NoneType' object is not subscriptable", because they are listed in the nodes, but not relevant for dbt-coverage.
  • Loading branch information
BI-MarcB authored Aug 8, 2023
1 parent dc828e4 commit d20c784
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions dbt_coverage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ def from_node(node, manifest: Manifest) -> Table:

if original_file_path is None:
logging.warning("original_file_path value not found in manifest for %s", unique_id)

return Table(
unique_id,
# Take table name from manifest.json instead of catalog.json since in catalog.json the
# name is actually an alias in case it is defined.
manifest_table["name"].lower(),
original_file_path,
{col.name: col for col in columns},
)
else:
return Table(
unique_id,
# Take table name from manifest.json instead of catalog.json since in catalog.json the
# name is actually an alias in case it is defined.
manifest_table["name"].lower(),
original_file_path,
{col.name: col for col in columns},
)

def get_column(self, column_name):
return self.columns.get(column_name)
Expand Down Expand Up @@ -120,7 +120,8 @@ def filter_tables(self, model_path_filter: List[str]) -> Catalog:

@staticmethod
def from_nodes(nodes, manifest: Manifest):
tables = [Table.from_node(table, manifest) for table in nodes]
tables_tmp = [Table.from_node(table, manifest) for table in nodes]
tables = [table for table in tables_tmp if table is not None]
return Catalog({table.unique_id: table for table in tables})

def get_table(self, table_id):
Expand Down

0 comments on commit d20c784

Please sign in to comment.