-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jvandooren/getting-started-documentation
- Loading branch information
Showing
25 changed files
with
502 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to | ||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- CLI based on Click. | ||
- Ability to parse dbt's `manifest.json` into internal structures. | ||
- Rule registry and rule discovery. | ||
- Rule API, decorator-based or class-based. | ||
- Linting and scoring functionality for dbt models. | ||
- Configuration through `pyproject.toml`. | ||
- Default rules in `dbt_score.rules.generic`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(content generated in CI) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Formatter for a manifest.json.""" | ||
|
||
import copy | ||
import json | ||
from typing import Any | ||
|
||
from dbt_score.evaluation import ModelResultsType | ||
from dbt_score.formatters import Formatter | ||
from dbt_score.models import Model | ||
|
||
|
||
class ManifestFormatter(Formatter): | ||
"""Formatter to generate manifest.json with score metadata.""" | ||
|
||
def __init__(self, *args: Any, **kwargs: Any) -> None: | ||
"""Instantiate a manifest formatter.""" | ||
self._model_scores: dict[str, float] = {} | ||
super().__init__(*args, **kwargs) | ||
|
||
def model_evaluated( | ||
self, model: Model, results: ModelResultsType, score: float | ||
) -> None: | ||
"""Callback when a model has been evaluated.""" | ||
self._model_scores[model.unique_id] = score | ||
|
||
def project_evaluated(self, score: float) -> None: | ||
"""Callback when a project has been evaluated.""" | ||
manifest = copy.copy(self._manifest_loader.raw_manifest) | ||
for model_id, score in self._model_scores.items(): | ||
manifest["nodes"][model_id]["meta"]["score"] = round(score, 1) | ||
print(json.dumps(manifest, indent=2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.