Skip to content

Commit

Permalink
fix: store_failures crashing compute
Browse files Browse the repository at this point in the history
Fixes:
- #52
- #62
  • Loading branch information
sweco committed Nov 8, 2023
1 parent 5926212 commit 90fef39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Integration tests

### Fixed
- `store_failures` crashing `compute`

## [0.3.4] - 2023-05-17
### Added
- Support for `dbt==1.4` and `dbt==1.5`
Expand Down
6 changes: 5 additions & 1 deletion dbt_coverage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ class Table:
def from_node(node, manifest: Manifest) -> Table:
unique_id = node["unique_id"]
manifest_table = manifest.get_table(unique_id)
if manifest_table is None:
raise ValueError(f"Unique ID {unique_id} not found in manifest.json")
columns = [Column.from_node(col) for col in node["columns"].values()]
original_file_path = manifest_table["original_file_path"] if manifest_table else None
original_file_path = manifest_table["original_file_path"]

if original_file_path is None:
logging.warning("original_file_path value not found in manifest for %s", unique_id)
Expand Down Expand Up @@ -679,6 +681,8 @@ def load_catalog(project_dir: Path, run_artifacts_dir: Path, manifest: Manifest)
catalog_json = json.load(f)

catalog_nodes = {**catalog_json["sources"], **catalog_json["nodes"]}
# Filter out tables storing test failures: https://github.com/slidoapp/dbt-coverage/issues/62
catalog_nodes = {n_id: n for n_id, n in catalog_nodes.items() if not n_id.startswith("test.")}
catalog = Catalog.from_nodes(catalog_nodes.values(), manifest)

logging.info("Successfully loaded %d tables from catalog", len(catalog.tables))
Expand Down

0 comments on commit 90fef39

Please sign in to comment.