checkup-dbt 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checkup_dbt-0.2.0/.gitignore +15 -0
- checkup_dbt-0.2.0/PKG-INFO +7 -0
- checkup_dbt-0.2.0/pyproject.toml +25 -0
- checkup_dbt-0.2.0/src/checkup_dbt/__init__.py +57 -0
- checkup_dbt-0.2.0/src/checkup_dbt/manifest_query.py +199 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/__init__.py +58 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/base.py +139 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/core/__init__.py +21 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/core/columns.py +11 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/core/columns_description.py +25 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/core/models.py +10 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/core/models_description.py +20 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/core/tests.py +13 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/output/__init__.py +19 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/output/output_columns_without_data_type.py +16 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/output/output_models.py +12 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/output/output_models_description.py +24 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/output/output_models_without_contracts.py +13 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/quality/__init__.py +15 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/quality/flagged_packages.py +62 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/quality/naming_convention.py +53 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/quality/profile_host.py +77 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/quality/supported_version.py +41 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/quality/version.py +24 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/test/__init__.py +13 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/test/column_test_coverage.py +37 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/test/column_tests.py +15 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/test/data_tests.py +15 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/test/tested_columns.py +44 -0
- checkup_dbt-0.2.0/src/checkup_dbt/metrics/test/unit_tests.py +15 -0
- checkup_dbt-0.2.0/src/checkup_dbt/provider.py +128 -0
- checkup_dbt-0.2.0/tests/__init__.py +0 -0
- checkup_dbt-0.2.0/tests/conftest.py +99 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/.gitignore +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/.user.yml +1 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.circleci/config.yml +102 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/CODEOWNERS +1 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/bug_report.md +60 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/dbt_minor_release.md +29 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/utils_minor_release.md +38 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/pull_request_template.md +29 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.github/workflows/create-table-of-contents.yml +24 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/.gitignore +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/CHANGELOG.md +497 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/CONTRIBUTING.md +87 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/LICENSE +201 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/Makefile +24 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/README.md +1422 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/RELEASE.md +37 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/dbt_project.yml +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/dev-requirements.txt +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/docker-compose.yml +8 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/docs/decisions/README.md +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/docs/decisions/adr-0000-documenting-architecture-decisions.md +60 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/docs/decisions/adr-0001-decision-record-format.md +38 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/docs/decisions/adr-0002-cross-database-utils.md +87 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/etc/dbt-logo.png +0 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/.gitignore +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/README.md +130 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/ci/sample.profiles.yml +49 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/.gitkeep +0 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/datetime/data_date_spine.csv +10 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/etc/data_people.csv +101 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_km.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_mi.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_a.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_b.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_not_null_proportion.csv +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_accepted_range.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_at_least_one.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_equal_rowcount.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_expression_is_true.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_1.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_2.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_no_gaps.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps_zero_length.csv +8 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_accepted_values.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_constant.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_1.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_2.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_timestamps.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_values.csv +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_unique_combination_of_columns.csv +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/schema_tests/schema.yml +21 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate_expected.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180101.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180102.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180103.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation_expected.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_generate_series.csv +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_generate_surrogate_key.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values.csv +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_dropped.csv +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where.csv +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where_expected.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_query_results_as_dict.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_single_value.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_nullcheck_table.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected_apostrophe.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_add.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_divide.csv +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_divide_denominator_expressions.csv +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_divide_numerator_expressions.csv +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_subtract.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_star.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate_expected.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_expected.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_prefix_suffix_expected.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_quote_identifiers.csv +2 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_events_expected.csv +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_exclude_expected.csv +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_expected.csv +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_1.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_2.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool.csv +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool_expected.csv +10 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_expected.csv +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_original_api_expected.csv +10 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/sql/data_width_bucket.csv +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/web/data_url_host.csv +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/web/data_url_path.csv +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/data/web/data_urls.csv +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/dbt_project.yml +55 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/macros/.gitkeep +0 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/macros/assert_equal_values.sql +32 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/macros/limit_zero.sql +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/macros/tests.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/datetime/schema.yml +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/datetime/test_date_spine.sql +26 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/generic_tests/recency_time_excluded.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/generic_tests/recency_time_included.sql +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/generic_tests/schema.yml +201 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_column_subset.sql +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_rowcount.sql +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_fewer_rows_than.sql +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/geo/schema.yml +13 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_km.sql +23 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_mi.sql +39 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/schema.yml +266 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate.sql +21 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_generate_series.sql +15 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_generate_surrogate_key.sql +14 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values.sql +29 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values_where.sql +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_filtered_columns_in_relation.sql +16 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_pattern.sql +18 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_prefix_and_union.sql +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_single_value.sql +42 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_single_value_default.sql +28 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_groupby.sql +24 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_not_empty_string_failing.sql +41 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_not_empty_string_passing.sql +33 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_nullcheck_table.sql +41 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot.sql +17 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot_apostrophe.sql +17 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_safe_add.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_safe_divide.sql +38 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_safe_subtract.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_star.sql +13 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_aggregate.sql +16 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_no_columns.sql +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_prefix_suffix.sql +13 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_quote_identifiers.sql +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_uppercase.sql +13 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union.sql +8 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_base.sql +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_exclude_base_lowercase.sql +8 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_exclude_base_uppercase.sql +8 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_exclude_lowercase.sql +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_exclude_uppercase.sql +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_no_source_column.sql +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where.sql +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where_base.sql +4 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot.sql +33 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_bool.sql +32 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/sql/test_width_bucket.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/web/schema.yml +20 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/web/test_url_host.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/web/test_url_path.sql +12 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/models/web/test_urls.sql +20 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/packages.yml +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/assert_get_query_results_as_dict_objects_equal.sql +81 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/generic/expect_table_columns_to_match_set.sql +54 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_output_msg_is_string.sql +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_time_is_string.sql +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/test_slugify.sql +9 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/sql/test_get_column_values_use_default.sql +33 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/integration_tests/tests/sql/test_get_single_value_multiple_rows.sql +18 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/accepted_range.sql +33 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/at_least_one.sql +46 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/cardinality_equality.sql +53 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/equal_rowcount.sql +76 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/equality.sql +75 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/expression_is_true.sql +18 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/fewer_rows_than.sql +80 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/mutually_exclusive_ranges.sql +97 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/not_accepted_values.sql +37 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/not_constant.sql +27 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/not_empty_string.sql +39 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/not_null_proportion.sql +34 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/recency.sql +41 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/relationships_where.sql +51 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/sequential_values.sql +42 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/generic_tests/unique_combination_of_columns.sql +37 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/jinja_helpers/_is_ephemeral.sql +16 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/jinja_helpers/_is_relation.sql +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/jinja_helpers/log_info.sql +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_log_format.sql +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_time.sql +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/jinja_helpers/slugify.sql +14 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/date_spine.sql +75 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/deduplicate.sql +87 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/generate_series.sql +53 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/generate_surrogate_key.sql +29 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_column_values.sql +65 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_filtered_columns_in_relation.sql +25 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_query_results_as_dict.sql +26 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_relations_by_pattern.sql +32 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_relations_by_prefix.sql +32 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_single_value.sql +33 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_table_types_sql.sql +32 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_tables_by_pattern_sql.sql +70 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/get_tables_by_prefix_sql.sql +14 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/groupby.sql +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/haversine_distance.sql +51 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/nullcheck.sql +21 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/nullcheck_table.sql +14 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/pivot.sql +86 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/safe_add.sql +28 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/safe_divide.sql +7 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/safe_subtract.sql +28 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/star.sql +40 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/surrogate_key.sql +20 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/union.sql +128 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/unpivot.sql +66 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/sql/width_bucket.sql +34 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/web/get_url_host.sql +27 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/web/get_url_parameter.sql +13 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/macros/web/get_url_path.sql +34 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/pytest.ini +8 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/run_functional_test.sh +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/run_test.sh +18 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/tests/__init__.py +0 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_packages/dbt_utils/tests/conftest.py +98 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/dbt_project.yml +11 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/logs/dbt.log +47 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/models/marts/customers.sql +10 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/models/marts/schema.yml +28 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/models/staging/schema.yml +45 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/models/staging/stg_customers.sql +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/models/staging/stg_orders.sql +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/package-lock.yml +5 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/packages.yml +3 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/profiles.yml +6 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/target/manifest.json +1 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/target/partial_parse.msgpack +0 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/target/perf_info.json +62 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/target/semantic_manifest.json +1 -0
- checkup_dbt-0.2.0/tests/fixtures/sample_dbt_project/tests/assert_positive_amounts.sql +4 -0
- checkup_dbt-0.2.0/tests/test_all_metrics.py +64 -0
- checkup_dbt-0.2.0/tests/test_core_metrics.py +105 -0
- checkup_dbt-0.2.0/tests/test_output_metrics.py +77 -0
- checkup_dbt-0.2.0/tests/test_provider.py +75 -0
- checkup_dbt-0.2.0/tests/test_quality_metrics.py +206 -0
- checkup_dbt-0.2.0/tests/test_test_metrics.py +81 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "checkup-dbt"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "dbt metrics for checkup"
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"checkup",
|
|
8
|
+
"dbt-core>=1.9",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[dependency-groups]
|
|
12
|
+
dev = [
|
|
13
|
+
"pytest>=8.0",
|
|
14
|
+
"dbt-duckdb>=1.9",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[tool.uv.sources]
|
|
18
|
+
checkup = { workspace = true }
|
|
19
|
+
|
|
20
|
+
[build-system]
|
|
21
|
+
requires = ["hatchling"]
|
|
22
|
+
build-backend = "hatchling.build"
|
|
23
|
+
|
|
24
|
+
[tool.hatch.build.targets.wheel]
|
|
25
|
+
packages = ["src/checkup_dbt"]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""dbt metrics for checkup."""
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.metrics import (
|
|
4
|
+
DbtColumnsMetric,
|
|
5
|
+
DbtColumnsWithDescriptionMetric,
|
|
6
|
+
DbtColumnsWithoutDescriptionMetric,
|
|
7
|
+
DbtColumnTestCoverageMetric,
|
|
8
|
+
DbtColumnTestsMetric,
|
|
9
|
+
DbtDataTestsMetric,
|
|
10
|
+
DbtFlaggedPackagesMetric,
|
|
11
|
+
DbtMetric,
|
|
12
|
+
DbtModelsMetric,
|
|
13
|
+
DbtModelsNotAdheringToNamingConventionMetric,
|
|
14
|
+
DbtModelsWithDescriptionMetric,
|
|
15
|
+
DbtModelsWithoutDescriptionMetric,
|
|
16
|
+
DbtOutputColumnsWithoutDataTypeMetric,
|
|
17
|
+
DbtOutputModelsMetric,
|
|
18
|
+
DbtOutputModelsWithDescriptionMetric,
|
|
19
|
+
DbtOutputModelsWithoutContractsMetric,
|
|
20
|
+
DbtOutputModelsWithoutDescriptionMetric,
|
|
21
|
+
DbtProfileHostMetric,
|
|
22
|
+
DbtSupportedVersionMetric,
|
|
23
|
+
DbtTestedColumnsMetric,
|
|
24
|
+
DbtTestsMetric,
|
|
25
|
+
DbtUnitTestsMetric,
|
|
26
|
+
DbtVersionMetric,
|
|
27
|
+
NamingConventionChecker,
|
|
28
|
+
)
|
|
29
|
+
from checkup_dbt.provider import DbtManifestProvider
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"DbtManifestProvider",
|
|
33
|
+
"DbtMetric",
|
|
34
|
+
"NamingConventionChecker",
|
|
35
|
+
"DbtModelsMetric",
|
|
36
|
+
"DbtColumnsMetric",
|
|
37
|
+
"DbtTestsMetric",
|
|
38
|
+
"DbtModelsWithDescriptionMetric",
|
|
39
|
+
"DbtModelsWithoutDescriptionMetric",
|
|
40
|
+
"DbtColumnsWithDescriptionMetric",
|
|
41
|
+
"DbtColumnsWithoutDescriptionMetric",
|
|
42
|
+
"DbtUnitTestsMetric",
|
|
43
|
+
"DbtDataTestsMetric",
|
|
44
|
+
"DbtColumnTestsMetric",
|
|
45
|
+
"DbtTestedColumnsMetric",
|
|
46
|
+
"DbtColumnTestCoverageMetric",
|
|
47
|
+
"DbtOutputModelsMetric",
|
|
48
|
+
"DbtOutputModelsWithDescriptionMetric",
|
|
49
|
+
"DbtOutputModelsWithoutDescriptionMetric",
|
|
50
|
+
"DbtOutputModelsWithoutContractsMetric",
|
|
51
|
+
"DbtOutputColumnsWithoutDataTypeMetric",
|
|
52
|
+
"DbtFlaggedPackagesMetric",
|
|
53
|
+
"DbtProfileHostMetric",
|
|
54
|
+
"DbtModelsNotAdheringToNamingConventionMetric",
|
|
55
|
+
"DbtSupportedVersionMetric",
|
|
56
|
+
"DbtVersionMetric",
|
|
57
|
+
]
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""ManifestQuery utility for querying dbt manifest data.
|
|
2
|
+
|
|
3
|
+
Provides a fluent interface for filtering and counting nodes in dbt manifests.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Callable, Iterable
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from dbt.artifacts.resources.types import NodeType
|
|
12
|
+
from dbt.contracts.graph.manifest import Manifest
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ManifestQuery:
|
|
16
|
+
"""Fluent query builder for dbt manifest nodes.
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
count = (
|
|
20
|
+
ManifestQuery(manifest)
|
|
21
|
+
.filter_by_type(NodeType.Model)
|
|
22
|
+
.filter(lambda n: n.description != "")
|
|
23
|
+
.count()
|
|
24
|
+
)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, manifest: Manifest):
|
|
28
|
+
"""Initialize with a dbt manifest.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
manifest: The dbt Manifest object to query
|
|
32
|
+
"""
|
|
33
|
+
self._manifest = manifest
|
|
34
|
+
self._nodes: Iterable[Any] | None = None
|
|
35
|
+
self._filters: list[Callable[[Any], bool]] = []
|
|
36
|
+
|
|
37
|
+
def _get_nodes(self) -> Iterable[Any]:
|
|
38
|
+
"""Get the current node set."""
|
|
39
|
+
if self._nodes is not None:
|
|
40
|
+
return self._nodes
|
|
41
|
+
return self._manifest.nodes.values()
|
|
42
|
+
|
|
43
|
+
def filter_by_type(self, resource_type: NodeType) -> ManifestQuery:
|
|
44
|
+
"""Filter nodes by resource type.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
resource_type: The NodeType to filter by (e.g., NodeType.Model)
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Self for chaining
|
|
51
|
+
"""
|
|
52
|
+
self._filters.append(lambda n: n.resource_type == resource_type)
|
|
53
|
+
return self
|
|
54
|
+
|
|
55
|
+
def filter(self, predicate: Callable[[Any], bool]) -> ManifestQuery:
|
|
56
|
+
"""Filter nodes by a custom predicate.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
predicate: Function that returns True for nodes to include
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Self for chaining
|
|
63
|
+
"""
|
|
64
|
+
self._filters.append(predicate)
|
|
65
|
+
return self
|
|
66
|
+
|
|
67
|
+
def _apply_filters(self) -> list[Any]:
|
|
68
|
+
"""Apply all filters and return matching nodes."""
|
|
69
|
+
nodes = list(self._get_nodes())
|
|
70
|
+
for f in self._filters:
|
|
71
|
+
nodes = [n for n in nodes if f(n)]
|
|
72
|
+
return nodes
|
|
73
|
+
|
|
74
|
+
def count(self) -> int:
|
|
75
|
+
"""Count nodes matching all filters.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Number of matching nodes
|
|
79
|
+
"""
|
|
80
|
+
return len(self._apply_filters())
|
|
81
|
+
|
|
82
|
+
def list(self) -> list[Any]:
|
|
83
|
+
"""Get list of nodes matching all filters.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
List of matching nodes
|
|
87
|
+
"""
|
|
88
|
+
return self._apply_filters()
|
|
89
|
+
|
|
90
|
+
def names(self) -> list[str]:
|
|
91
|
+
"""Get names of nodes matching all filters.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
List of node names, sorted alphabetically
|
|
95
|
+
"""
|
|
96
|
+
return sorted(n.name for n in self._apply_filters())
|
|
97
|
+
|
|
98
|
+
def count_columns(
|
|
99
|
+
self, column_predicate: Callable[[Any, str, Any], bool] | None = None
|
|
100
|
+
) -> int:
|
|
101
|
+
"""Count columns across matching nodes.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
column_predicate: Optional function(node, col_name, col) -> bool
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Total column count across matching nodes
|
|
108
|
+
"""
|
|
109
|
+
nodes = self._apply_filters()
|
|
110
|
+
count = 0
|
|
111
|
+
for node in nodes:
|
|
112
|
+
for col_name, col in node.columns.items():
|
|
113
|
+
if column_predicate is None or column_predicate(node, col_name, col):
|
|
114
|
+
count += 1
|
|
115
|
+
return count
|
|
116
|
+
|
|
117
|
+
def columns(
|
|
118
|
+
self, column_predicate: Callable[[Any, str, Any], bool] | None = None
|
|
119
|
+
) -> list[tuple[Any, str, Any]]:
|
|
120
|
+
"""Get columns across matching nodes.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
column_predicate: Optional function(node, col_name, col) -> bool
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
List of (node, column_name, column) tuples
|
|
127
|
+
"""
|
|
128
|
+
nodes = self._apply_filters()
|
|
129
|
+
result = []
|
|
130
|
+
for node in nodes:
|
|
131
|
+
for col_name, col in node.columns.items():
|
|
132
|
+
if column_predicate is None or column_predicate(node, col_name, col):
|
|
133
|
+
result.append((node, col_name, col))
|
|
134
|
+
return result
|
|
135
|
+
|
|
136
|
+
def column_names(
|
|
137
|
+
self, column_predicate: Callable[[Any, str, Any], bool] | None = None
|
|
138
|
+
) -> list[str]:
|
|
139
|
+
"""Get column names in 'model.column' format.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
column_predicate: Optional function(node, col_name, col) -> bool
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
List of 'model.column' strings, sorted
|
|
146
|
+
"""
|
|
147
|
+
columns = self.columns(column_predicate)
|
|
148
|
+
return sorted(f"{node.name}.{col_name}" for node, col_name, _ in columns)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Common predicates for reuse
|
|
152
|
+
def has_description(node: Any) -> bool:
|
|
153
|
+
"""Check if node has a non-empty description."""
|
|
154
|
+
return node.description != ""
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def without_description(node: Any) -> bool:
|
|
158
|
+
"""Check if node is missing a description."""
|
|
159
|
+
return node.description == ""
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def is_output_model(node: Any) -> bool:
|
|
163
|
+
"""Check if node is an output model (non-internal schema)."""
|
|
164
|
+
return node.resource_type == NodeType.Model and not node.schema.endswith("__int")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def has_enforced_contract(node: Any) -> bool:
|
|
168
|
+
"""Check if node has an enforced contract."""
|
|
169
|
+
return node.contract.enforced
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def is_generic_test(node: Any) -> bool:
|
|
173
|
+
"""Check if node is a generic (data) test."""
|
|
174
|
+
return getattr(node, "test_node_type", None) == "generic"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def is_singular_test(node: Any) -> bool:
|
|
178
|
+
"""Check if node is a singular (unit) test."""
|
|
179
|
+
return getattr(node, "test_node_type", None) == "singular"
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def is_column_test(node: Any) -> bool:
|
|
183
|
+
"""Check if test targets a specific column."""
|
|
184
|
+
return hasattr(node, "column_name") and node.column_name is not None
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def column_has_description(_node: Any, _col_name: str, col: Any) -> bool:
|
|
188
|
+
"""Check if column has a non-empty description."""
|
|
189
|
+
return col.description != ""
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def column_without_description(_node: Any, _col_name: str, col: Any) -> bool:
|
|
193
|
+
"""Check if column is missing a description."""
|
|
194
|
+
return col.description == ""
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def column_missing_data_type(_node: Any, _col_name: str, col: Any) -> bool:
|
|
198
|
+
"""Check if column is missing a data type."""
|
|
199
|
+
return col.data_type is None
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from checkup_dbt.metrics.base import DbtMetric, NamingConventionChecker
|
|
2
|
+
from checkup_dbt.metrics.core import (
|
|
3
|
+
DbtColumnsMetric,
|
|
4
|
+
DbtColumnsWithDescriptionMetric,
|
|
5
|
+
DbtColumnsWithoutDescriptionMetric,
|
|
6
|
+
DbtModelsMetric,
|
|
7
|
+
DbtModelsWithDescriptionMetric,
|
|
8
|
+
DbtModelsWithoutDescriptionMetric,
|
|
9
|
+
DbtTestsMetric,
|
|
10
|
+
)
|
|
11
|
+
from checkup_dbt.metrics.output import (
|
|
12
|
+
DbtOutputColumnsWithoutDataTypeMetric,
|
|
13
|
+
DbtOutputModelsMetric,
|
|
14
|
+
DbtOutputModelsWithDescriptionMetric,
|
|
15
|
+
DbtOutputModelsWithoutContractsMetric,
|
|
16
|
+
DbtOutputModelsWithoutDescriptionMetric,
|
|
17
|
+
)
|
|
18
|
+
from checkup_dbt.metrics.quality import (
|
|
19
|
+
DbtFlaggedPackagesMetric,
|
|
20
|
+
DbtModelsNotAdheringToNamingConventionMetric,
|
|
21
|
+
DbtProfileHostMetric,
|
|
22
|
+
DbtSupportedVersionMetric,
|
|
23
|
+
DbtVersionMetric,
|
|
24
|
+
)
|
|
25
|
+
from checkup_dbt.metrics.test import (
|
|
26
|
+
DbtColumnTestCoverageMetric,
|
|
27
|
+
DbtColumnTestsMetric,
|
|
28
|
+
DbtDataTestsMetric,
|
|
29
|
+
DbtTestedColumnsMetric,
|
|
30
|
+
DbtUnitTestsMetric,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"DbtMetric",
|
|
35
|
+
"NamingConventionChecker",
|
|
36
|
+
"DbtModelsMetric",
|
|
37
|
+
"DbtColumnsMetric",
|
|
38
|
+
"DbtTestsMetric",
|
|
39
|
+
"DbtModelsWithDescriptionMetric",
|
|
40
|
+
"DbtModelsWithoutDescriptionMetric",
|
|
41
|
+
"DbtColumnsWithDescriptionMetric",
|
|
42
|
+
"DbtColumnsWithoutDescriptionMetric",
|
|
43
|
+
"DbtUnitTestsMetric",
|
|
44
|
+
"DbtDataTestsMetric",
|
|
45
|
+
"DbtColumnTestsMetric",
|
|
46
|
+
"DbtTestedColumnsMetric",
|
|
47
|
+
"DbtColumnTestCoverageMetric",
|
|
48
|
+
"DbtOutputModelsMetric",
|
|
49
|
+
"DbtOutputModelsWithDescriptionMetric",
|
|
50
|
+
"DbtOutputModelsWithoutDescriptionMetric",
|
|
51
|
+
"DbtOutputModelsWithoutContractsMetric",
|
|
52
|
+
"DbtOutputColumnsWithoutDataTypeMetric",
|
|
53
|
+
"DbtFlaggedPackagesMetric",
|
|
54
|
+
"DbtModelsNotAdheringToNamingConventionMetric",
|
|
55
|
+
"DbtProfileHostMetric",
|
|
56
|
+
"DbtSupportedVersionMetric",
|
|
57
|
+
"DbtVersionMetric",
|
|
58
|
+
]
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from collections.abc import Callable
|
|
5
|
+
from enum import Enum, auto
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, ClassVar
|
|
8
|
+
|
|
9
|
+
from dbt.artifacts.resources.types import NodeType
|
|
10
|
+
from dbt.contracts.graph.manifest import Manifest
|
|
11
|
+
|
|
12
|
+
from checkup.metric import Metric
|
|
13
|
+
from checkup.provider import Provider
|
|
14
|
+
from checkup.types import Context
|
|
15
|
+
from checkup_dbt.manifest_query import ManifestQuery
|
|
16
|
+
from checkup_dbt.provider import DbtManifestProvider
|
|
17
|
+
|
|
18
|
+
NamingConventionChecker = Callable[[Context, Any], bool]
|
|
19
|
+
|
|
20
|
+
logger = logging.getLogger(__name__)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CountTarget(Enum):
|
|
24
|
+
"""What to count in a diagnostic metric."""
|
|
25
|
+
|
|
26
|
+
NODES = auto()
|
|
27
|
+
COLUMNS = auto()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class DbtMetric(Metric):
|
|
31
|
+
"""Base class for dbt metrics."""
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def providers(cls) -> list[type[Provider]]:
|
|
35
|
+
return [DbtManifestProvider]
|
|
36
|
+
|
|
37
|
+
def get_manifest(self, context: Context) -> Manifest:
|
|
38
|
+
"""Get the manifest from context.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
context: The context dict
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
The dbt Manifest object
|
|
45
|
+
"""
|
|
46
|
+
return context[DbtManifestProvider.name]["manifest"]
|
|
47
|
+
|
|
48
|
+
def get_project_dir(self, context: Context) -> Path:
|
|
49
|
+
"""Get the dbt project directory from context.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
context: The context dict
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
Path to the dbt project directory
|
|
56
|
+
"""
|
|
57
|
+
return context[DbtManifestProvider.name]["project_dir"]
|
|
58
|
+
|
|
59
|
+
def query(self, context: Context) -> ManifestQuery:
|
|
60
|
+
"""Create a ManifestQuery for the context's manifest.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
context: The context dict
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
ManifestQuery instance for fluent querying
|
|
67
|
+
"""
|
|
68
|
+
return ManifestQuery(self.get_manifest(context))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class DbtCountMetric(DbtMetric):
|
|
72
|
+
"""Base class for metrics that count nodes or columns.
|
|
73
|
+
|
|
74
|
+
Subclasses should define:
|
|
75
|
+
- name, description, unit (ClassVars)
|
|
76
|
+
- resource_type: The NodeType to filter by
|
|
77
|
+
- count_target: What to count (NODES or COLUMNS)
|
|
78
|
+
- predicate (optional): Filter function
|
|
79
|
+
- For NODES: Callable[[node], bool]
|
|
80
|
+
- For COLUMNS: Callable[[node, col_name, col], bool]
|
|
81
|
+
- log_message: Template for log message (uses {value})
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
resource_type: ClassVar[NodeType] = NodeType.Model
|
|
85
|
+
count_target: ClassVar[CountTarget] = CountTarget.NODES
|
|
86
|
+
predicate: ClassVar[Callable[..., bool] | None] = None
|
|
87
|
+
log_message: ClassVar[str] = "Found {value} items"
|
|
88
|
+
|
|
89
|
+
def calculate(self, context: Context, metrics: dict) -> None:
|
|
90
|
+
cls = type(self)
|
|
91
|
+
query = self.query(context).filter_by_type(cls.resource_type)
|
|
92
|
+
|
|
93
|
+
if cls.count_target == CountTarget.COLUMNS:
|
|
94
|
+
self.value = query.count_columns(cls.predicate)
|
|
95
|
+
else:
|
|
96
|
+
if cls.predicate:
|
|
97
|
+
query = query.filter(cls.predicate)
|
|
98
|
+
self.value = query.count()
|
|
99
|
+
|
|
100
|
+
logger.info(cls.log_message.format(value=self.value))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class DbtDiagnosticMetric(DbtMetric):
|
|
104
|
+
"""Base class for metrics that count and list items with diagnostics.
|
|
105
|
+
|
|
106
|
+
Produces both a count and a diagnostic listing the items.
|
|
107
|
+
|
|
108
|
+
Subclasses should define:
|
|
109
|
+
- name, description, unit (ClassVars)
|
|
110
|
+
- resource_type: The NodeType to filter by
|
|
111
|
+
- count_target: What to count (NODES or COLUMNS)
|
|
112
|
+
- predicate (optional): Filter function
|
|
113
|
+
- For NODES: Callable[[node], bool]
|
|
114
|
+
- For COLUMNS: Callable[[node, col_name, col], bool]
|
|
115
|
+
- diagnostic_prefix: Prefix for diagnostic message
|
|
116
|
+
- log_message: Template for log message (uses {value})
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
resource_type: ClassVar[NodeType] = NodeType.Model
|
|
120
|
+
count_target: ClassVar[CountTarget] = CountTarget.NODES
|
|
121
|
+
predicate: ClassVar[Callable[..., bool] | None] = None
|
|
122
|
+
diagnostic_prefix: ClassVar[str] = "Items"
|
|
123
|
+
log_message: ClassVar[str] = "Found {value} items"
|
|
124
|
+
|
|
125
|
+
def calculate(self, context: Context, metrics: dict) -> None:
|
|
126
|
+
cls = type(self)
|
|
127
|
+
query = self.query(context).filter_by_type(cls.resource_type)
|
|
128
|
+
|
|
129
|
+
if cls.count_target == CountTarget.COLUMNS:
|
|
130
|
+
names = query.column_names(cls.predicate)
|
|
131
|
+
else:
|
|
132
|
+
if cls.predicate:
|
|
133
|
+
query = query.filter(cls.predicate)
|
|
134
|
+
names = query.names()
|
|
135
|
+
|
|
136
|
+
self.value = len(names)
|
|
137
|
+
if names:
|
|
138
|
+
self.diagnostic = f"{cls.diagnostic_prefix}: {', '.join(names)}"
|
|
139
|
+
logger.info(cls.log_message.format(value=self.value))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from checkup_dbt.metrics.core.columns import DbtColumnsMetric
|
|
2
|
+
from checkup_dbt.metrics.core.columns_description import (
|
|
3
|
+
DbtColumnsWithDescriptionMetric,
|
|
4
|
+
DbtColumnsWithoutDescriptionMetric,
|
|
5
|
+
)
|
|
6
|
+
from checkup_dbt.metrics.core.models import DbtModelsMetric
|
|
7
|
+
from checkup_dbt.metrics.core.models_description import (
|
|
8
|
+
DbtModelsWithDescriptionMetric,
|
|
9
|
+
DbtModelsWithoutDescriptionMetric,
|
|
10
|
+
)
|
|
11
|
+
from checkup_dbt.metrics.core.tests import DbtTestsMetric
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"DbtModelsMetric",
|
|
15
|
+
"DbtColumnsMetric",
|
|
16
|
+
"DbtTestsMetric",
|
|
17
|
+
"DbtModelsWithDescriptionMetric",
|
|
18
|
+
"DbtModelsWithoutDescriptionMetric",
|
|
19
|
+
"DbtColumnsWithDescriptionMetric",
|
|
20
|
+
"DbtColumnsWithoutDescriptionMetric",
|
|
21
|
+
]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.metrics.base import CountTarget, DbtCountMetric
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DbtColumnsMetric(DbtCountMetric):
|
|
7
|
+
name: ClassVar[str] = "dbt_columns"
|
|
8
|
+
description: ClassVar[str] = "Total number of columns across all models"
|
|
9
|
+
unit: ClassVar[str] = "columns"
|
|
10
|
+
count_target: ClassVar[CountTarget] = CountTarget.COLUMNS
|
|
11
|
+
log_message: ClassVar[str] = "Found {value} columns"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.manifest_query import (
|
|
4
|
+
column_has_description,
|
|
5
|
+
column_without_description,
|
|
6
|
+
)
|
|
7
|
+
from checkup_dbt.metrics.base import CountTarget, DbtCountMetric
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DbtColumnsWithDescriptionMetric(DbtCountMetric):
|
|
11
|
+
name: ClassVar[str] = "dbt_columns_with_description"
|
|
12
|
+
description: ClassVar[str] = "Number of columns with descriptions"
|
|
13
|
+
unit: ClassVar[str] = "columns"
|
|
14
|
+
count_target: ClassVar[CountTarget] = CountTarget.COLUMNS
|
|
15
|
+
predicate = column_has_description
|
|
16
|
+
log_message: ClassVar[str] = "Found {value} columns with descriptions"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DbtColumnsWithoutDescriptionMetric(DbtCountMetric):
|
|
20
|
+
name: ClassVar[str] = "dbt_columns_without_description"
|
|
21
|
+
description: ClassVar[str] = "Number of columns without descriptions"
|
|
22
|
+
unit: ClassVar[str] = "columns"
|
|
23
|
+
count_target: ClassVar[CountTarget] = CountTarget.COLUMNS
|
|
24
|
+
predicate = column_without_description
|
|
25
|
+
log_message: ClassVar[str] = "Found {value} columns without descriptions"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.metrics.base import DbtCountMetric
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DbtModelsMetric(DbtCountMetric):
|
|
7
|
+
name: ClassVar[str] = "dbt_models"
|
|
8
|
+
description: ClassVar[str] = "Total number of dbt models"
|
|
9
|
+
unit: ClassVar[str] = "models"
|
|
10
|
+
log_message: ClassVar[str] = "Found {value} models"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.manifest_query import has_description, without_description
|
|
4
|
+
from checkup_dbt.metrics.base import DbtCountMetric
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DbtModelsWithDescriptionMetric(DbtCountMetric):
|
|
8
|
+
name: ClassVar[str] = "dbt_models_with_description"
|
|
9
|
+
description: ClassVar[str] = "Number of models with descriptions"
|
|
10
|
+
unit: ClassVar[str] = "models"
|
|
11
|
+
predicate = has_description
|
|
12
|
+
log_message: ClassVar[str] = "Found {value} models with descriptions"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DbtModelsWithoutDescriptionMetric(DbtCountMetric):
|
|
16
|
+
name: ClassVar[str] = "dbt_models_without_description"
|
|
17
|
+
description: ClassVar[str] = "Number of models without descriptions"
|
|
18
|
+
unit: ClassVar[str] = "models"
|
|
19
|
+
predicate = without_description
|
|
20
|
+
log_message: ClassVar[str] = "Found {value} models without descriptions"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from dbt.artifacts.resources.types import NodeType
|
|
4
|
+
|
|
5
|
+
from checkup_dbt.metrics.base import DbtCountMetric
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DbtTestsMetric(DbtCountMetric):
|
|
9
|
+
name: ClassVar[str] = "dbt_tests"
|
|
10
|
+
description: ClassVar[str] = "Total number of dbt tests"
|
|
11
|
+
unit: ClassVar[str] = "tests"
|
|
12
|
+
resource_type: ClassVar[NodeType] = NodeType.Test
|
|
13
|
+
log_message: ClassVar[str] = "Found {value} tests"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from checkup_dbt.metrics.output.output_columns_without_data_type import (
|
|
2
|
+
DbtOutputColumnsWithoutDataTypeMetric,
|
|
3
|
+
)
|
|
4
|
+
from checkup_dbt.metrics.output.output_models import DbtOutputModelsMetric
|
|
5
|
+
from checkup_dbt.metrics.output.output_models_description import (
|
|
6
|
+
DbtOutputModelsWithDescriptionMetric,
|
|
7
|
+
DbtOutputModelsWithoutDescriptionMetric,
|
|
8
|
+
)
|
|
9
|
+
from checkup_dbt.metrics.output.output_models_without_contracts import (
|
|
10
|
+
DbtOutputModelsWithoutContractsMetric,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"DbtOutputModelsMetric",
|
|
15
|
+
"DbtOutputModelsWithDescriptionMetric",
|
|
16
|
+
"DbtOutputModelsWithoutDescriptionMetric",
|
|
17
|
+
"DbtOutputModelsWithoutContractsMetric",
|
|
18
|
+
"DbtOutputColumnsWithoutDataTypeMetric",
|
|
19
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.manifest_query import is_output_model
|
|
4
|
+
from checkup_dbt.metrics.base import CountTarget, DbtDiagnosticMetric
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DbtOutputColumnsWithoutDataTypeMetric(DbtDiagnosticMetric):
|
|
8
|
+
name: ClassVar[str] = "dbt_output_columns_without_data_type"
|
|
9
|
+
description: ClassVar[str] = "Number of columns in output models without data type"
|
|
10
|
+
unit: ClassVar[str] = "columns"
|
|
11
|
+
predicate = staticmethod(
|
|
12
|
+
lambda n, _name, col: is_output_model(n) and col.data_type is None
|
|
13
|
+
)
|
|
14
|
+
diagnostic_prefix: ClassVar[str] = "Output columns without data type"
|
|
15
|
+
log_message: ClassVar[str] = "Found {value} output columns without data type"
|
|
16
|
+
count_target: ClassVar[CountTarget] = CountTarget.COLUMNS
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from checkup_dbt.manifest_query import is_output_model
|
|
4
|
+
from checkup_dbt.metrics.base import DbtCountMetric
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DbtOutputModelsMetric(DbtCountMetric):
|
|
8
|
+
name: ClassVar[str] = "dbt_output_models"
|
|
9
|
+
description: ClassVar[str] = "Number of output models (non-internal schema)"
|
|
10
|
+
unit: ClassVar[str] = "models"
|
|
11
|
+
predicate = is_output_model
|
|
12
|
+
log_message: ClassVar[str] = "Found {value} output models"
|