Skip to content

Commit

Permalink
Add seed_run_results model and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kokorin committed Aug 8, 2024
1 parent 77477a0 commit fc8a563
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
10 changes: 9 additions & 1 deletion integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ elementary_tests:
pip install -r requirements.txt
```

4. Run the tests.
4. Install elementary-data

`elementary-data` is required for testing. Install specific version if latest doesn't fit your needs.

```shell
pip install elementary-data
```

5. Run the tests.

```shell
pytest -vvv -n8
Expand Down
32 changes: 32 additions & 0 deletions integration_tests/tests/test_dbt_artifacts/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,38 @@ def test_dbt_invocations(dbt_project: DbtProject):
)


def test_seed_run_results(dbt_project: DbtProject):
dbt_project.read_table("seed_run_results", raise_if_empty=False)


def test_job_run_results(dbt_project: DbtProject):
dbt_project.read_table("job_run_results", raise_if_empty=False)


def test_model_run_results(dbt_project: DbtProject):
dbt_project.read_table("model_run_results", raise_if_empty=False)


def test_snapshot_run_results(dbt_project: DbtProject):
dbt_project.read_table("snapshot_run_results", raise_if_empty=False)


def test_monitors_runs(dbt_project: DbtProject):
dbt_project.read_table("monitors_runs", raise_if_empty=False)


def test_dbt_artifacts_hashes(dbt_project: DbtProject):
dbt_project.read_table("dbt_artifacts_hashes", raise_if_empty=False)


def test_anomaly_threshold_sensitivity(dbt_project: DbtProject):
dbt_project.read_table("anomaly_threshold_sensitivity", raise_if_empty=False)


def test_metrics_anomaly_score(dbt_project: DbtProject):
dbt_project.read_table("metrics_anomaly_score", raise_if_empty=False)


@pytest.mark.requires_dbt_version("1.8.0")
def test_source_freshness_results(test_id: str, dbt_project: DbtProject):
source_config = {
Expand Down
44 changes: 44 additions & 0 deletions models/edr/run_results/seed_run_results.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{
config(
materialized = 'view',
bind=False
)
}}

with dbt_run_results as (
select * from {{ ref('dbt_run_results') }}
),

dbt_seeds as (
select * from {{ ref('dbt_seeds') }}
)

SELECT
run_results.model_execution_id,
run_results.unique_id,
run_results.invocation_id,
run_results.query_id,
run_results.name,
run_results.generated_at,
run_results.status,
run_results.full_refresh,
run_results.message,
run_results.execution_time,
run_results.execute_started_at,
run_results.execute_completed_at,
run_results.compile_started_at,
run_results.compile_completed_at,
run_results.compiled_code,
run_results.adapter_response,
run_results.thread_id,
seeds.database_name,
seeds.schema_name,
run_results.materialization,
seeds.tags,
seeds.package_name,
seeds.path,
seeds.original_path,
seeds.owner,
seeds.alias
FROM dbt_run_results run_results
JOIN dbt_seeds seeds ON run_results.unique_id = seeds.unique_id

0 comments on commit fc8a563

Please sign in to comment.