model2data 1.18.0__tar.gz → 1.20.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.
- {model2data-1.18.0/model2data.egg-info → model2data-1.20.0}/PKG-INFO +7 -1
- {model2data-1.18.0 → model2data-1.20.0}/README.md +6 -0
- {model2data-1.18.0 → model2data-1.20.0}/README_PYPI.md +6 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/cli.py +204 -3
- model2data-1.20.0/model2data/dashboards/__init__.py +94 -0
- model2data-1.20.0/model2data/dashboards/check.py +682 -0
- model2data-1.20.0/model2data/dashboards/reader.py +121 -0
- model2data-1.20.0/model2data/dashboards/types.py +228 -0
- model2data-1.20.0/model2data/dashboards/writer.py +107 -0
- model2data-1.20.0/model2data/guide/dashboards.md +96 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/guide/tune.md +3 -2
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/__init__.py +16 -1
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/slices.py +24 -6
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/values.py +190 -11
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/PUBLISHING.md +21 -2
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/README.md +3 -1
- model2data-1.20.0/model2data/spec/dashboards/README.md +232 -0
- model2data-1.20.0/model2data/spec/dashboards/dashboard.schema.json +152 -0
- model2data-1.20.0/model2data/spec/examples/coffee_webshop_sales.dashboard.yml +91 -0
- {model2data-1.18.0 → model2data-1.20.0/model2data.egg-info}/PKG-INFO +7 -1
- {model2data-1.18.0 → model2data-1.20.0}/model2data.egg-info/SOURCES.txt +12 -0
- {model2data-1.18.0 → model2data-1.20.0}/pyproject.toml +1 -1
- model2data-1.20.0/tests/test_dashboards.py +824 -0
- model2data-1.20.0/tests/test_dashboards_cli.py +224 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_determinism.py +9 -0
- model2data-1.20.0/tests/test_metrics_prepared.py +350 -0
- {model2data-1.18.0 → model2data-1.20.0}/LICENSE +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/LICENSE +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/VENDORED.md +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/base.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/column.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/enum.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/expression.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/index.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/note.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/project.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/reference.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/sticky_note.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/table.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/_classes/table_group.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/classes/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/constants.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/database.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/column.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/common.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/enum.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/generic.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/index.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/project.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/records.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/reference.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/sticky_note.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/table.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/table_group.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/definitions/table_partial.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/exceptions.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/parser/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/parser/blueprints.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/parser/parser.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/base.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/column.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/enum.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/expression.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/index.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/note.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/project.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/reference.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/renderer.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/sticky_note.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/table.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/table_group.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/dbml/default/utils.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/column.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/enum.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/expression.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/index.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/note.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/reference.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/renderer.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/table.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/renderer/sql/default/utils.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/_vendor/pydbml/tools.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/hint_tests.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/naming.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/project.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/dbt_project.yml.jinja +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/hint_macros/model2data_hint_tests.sql +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/hint_macros/model2data_parent_tests.sql +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/hint_macros/model2data_when_tests.sql +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/history_macros/model2data_history_tests.sql +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/macros/generate_schema_name.sql +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/templates/profiles.yml.jinja +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/dbt/tests.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/defects/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/defects/apply.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/defects/checks.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/defects/presets.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/defects/report.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/core.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/days.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/faker.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/hints.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/history.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/kinds.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/options.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/parents.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/relationships.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/timeline.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/generate/when.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/guide/setup.md +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/guide/triage.md +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/check.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/columns.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/dbt.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/expression.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/graph.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/infer.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/lightdash.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/ossie.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/reader.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/semantic.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/sql.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/metrics/types.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/_yaml.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/dbml.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/document.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/dump.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/engine.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/errors.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/reader.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/types.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/model/validate.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/output.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/parse/__init__.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/parse/dbml.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/examples/coffee_webshop.metrics.yml +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/examples/coffee_webshop.model2data.yml +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/metrics/README.md +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/metrics/metrics.schema.json +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/spec/model.schema.json +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data/utils.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data.egg-info/dependency_links.txt +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data.egg-info/entry_points.txt +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data.egg-info/requires.txt +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/model2data.egg-info/top_level.txt +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/setup.cfg +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_as_of_anchor.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_cli.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_cli_model.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_column_time_hints.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_coverage_gaps.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_days.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_dbml_parser.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_dbml_parser_fuzz.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_dbt_integration.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_dbt_naming.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_dbt_project.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_dbt_tests.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_defects.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_defects_dbt.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_defects_replay.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_defects_report.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_defects_review.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_distributions.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_examples_model.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_faker_name_inference.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_fast_paths.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_generation.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_guide.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_hint_tests.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_history.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_issue_lines.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_lone_country.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_cli.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_dbt.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_expression.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_lightdash.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_ossie.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_reader.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_semantic.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_slices.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_spec.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_metrics_values.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_model.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_model_dbml.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_model_edges.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_model_messages.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_model_vocabulary.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_options.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_parent_dates.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_release_stress.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_reproducibility.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_row_identity.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_shaping.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_spec_alignment.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_spec_schema.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_table_seeds.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_timeline.py +0 -0
- {model2data-1.18.0 → model2data-1.20.0}/tests/test_when.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: model2data
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.20.0
|
|
4
4
|
Summary: Turn a data model into realistic synthetic data, a runnable dbt project and metrics with known values
|
|
5
5
|
Author: JB Analytica
|
|
6
6
|
License-Expression: MIT
|
|
@@ -280,6 +280,12 @@ should fail. → [Defects on purpose](https://github.com/JB-Analytica/model2data
|
|
|
280
280
|
an Apache Ossie semantic model, and with `--lightdash` the same metrics as Lightdash reads them.
|
|
281
281
|
→ [Metrics with known values](https://github.com/JB-Analytica/model2data/blob/main/docs/metrics.md)
|
|
282
282
|
|
|
283
|
+
**Dashboards as files.** A `<name>.dashboard.yml` lays out KPI, chart, filter and table tiles
|
|
284
|
+
over the model's metrics and columns, and holds no values. `model2data dashboard check` checks it
|
|
285
|
+
offline, with the line and column of every issue and a suggestion for every unknown name;
|
|
286
|
+
[model2data studio](https://studio.jbanalytica.com) draws it with the numbers.
|
|
287
|
+
→ [The dashboard spec](https://github.com/JB-Analytica/model2data/blob/main/model2data/spec/dashboards/README.md)
|
|
288
|
+
|
|
283
289
|
**Validate in CI.** `model2data validate` prints GitHub annotations; `uses: JB-Analytica/model2data@v1`
|
|
284
290
|
fails a pull request that breaks a model. Pre-commit and GitLab CI too. → [Validate models in CI](https://github.com/JB-Analytica/model2data/blob/main/docs/ci.md)
|
|
285
291
|
|
|
@@ -233,6 +233,12 @@ should fail. → [Defects on purpose](docs/defects.md)
|
|
|
233
233
|
an Apache Ossie semantic model, and with `--lightdash` the same metrics as Lightdash reads them.
|
|
234
234
|
→ [Metrics with known values](docs/metrics.md)
|
|
235
235
|
|
|
236
|
+
**Dashboards as files.** A `<name>.dashboard.yml` lays out KPI, chart, filter and table tiles
|
|
237
|
+
over the model's metrics and columns, and holds no values. `model2data dashboard check` checks it
|
|
238
|
+
offline, with the line and column of every issue and a suggestion for every unknown name;
|
|
239
|
+
[model2data studio](https://studio.jbanalytica.com) draws it with the numbers.
|
|
240
|
+
→ [The dashboard spec](model2data/spec/dashboards/README.md)
|
|
241
|
+
|
|
236
242
|
**Validate in CI.** `model2data validate` prints GitHub annotations; `uses: JB-Analytica/model2data@v1`
|
|
237
243
|
fails a pull request that breaks a model. Pre-commit and GitLab CI too. → [Validate models in CI](docs/ci.md)
|
|
238
244
|
|
|
@@ -233,6 +233,12 @@ should fail. → [Defects on purpose](https://github.com/JB-Analytica/model2data
|
|
|
233
233
|
an Apache Ossie semantic model, and with `--lightdash` the same metrics as Lightdash reads them.
|
|
234
234
|
→ [Metrics with known values](https://github.com/JB-Analytica/model2data/blob/main/docs/metrics.md)
|
|
235
235
|
|
|
236
|
+
**Dashboards as files.** A `<name>.dashboard.yml` lays out KPI, chart, filter and table tiles
|
|
237
|
+
over the model's metrics and columns, and holds no values. `model2data dashboard check` checks it
|
|
238
|
+
offline, with the line and column of every issue and a suggestion for every unknown name;
|
|
239
|
+
[model2data studio](https://studio.jbanalytica.com) draws it with the numbers.
|
|
240
|
+
→ [The dashboard spec](https://github.com/JB-Analytica/model2data/blob/main/model2data/spec/dashboards/README.md)
|
|
241
|
+
|
|
236
242
|
**Validate in CI.** `model2data validate` prints GitHub annotations; `uses: JB-Analytica/model2data@v1`
|
|
237
243
|
fails a pull request that breaks a model. Pre-commit and GitLab CI too. → [Validate models in CI](https://github.com/JB-Analytica/model2data/blob/main/docs/ci.md)
|
|
238
244
|
|
|
@@ -13,6 +13,8 @@ from faker import Faker
|
|
|
13
13
|
from typer.core import TyperGroup
|
|
14
14
|
from typer.models import ParameterInfo
|
|
15
15
|
|
|
16
|
+
from model2data import dashboards
|
|
17
|
+
from model2data.dashboards.check import declared_model
|
|
16
18
|
from model2data.dbt.hint_tests import DEFAULT_TOLERANCE, SEVERITIES
|
|
17
19
|
from model2data.dbt.naming import dbt_names, for_dbt
|
|
18
20
|
from model2data.dbt.project import (
|
|
@@ -940,15 +942,18 @@ def validate_command(
|
|
|
940
942
|
dir_okay=False,
|
|
941
943
|
readable=True,
|
|
942
944
|
help=(
|
|
943
|
-
"The model a metrics file (*.metrics.yml)
|
|
944
|
-
"beside it with the same stem
|
|
945
|
+
"The model a metrics file (*.metrics.yml) or a dashboard (*.dashboard.yml) is "
|
|
946
|
+
"checked against. Default: the model beside it with the same stem "
|
|
947
|
+
"(coffee.model2data.yml for coffee.metrics.yml)."
|
|
945
948
|
),
|
|
946
949
|
),
|
|
947
950
|
):
|
|
948
951
|
"""Check that models conform to spec 0.5.0 (or 0.2.x-0.4.x), printing every issue with its path.
|
|
949
952
|
|
|
950
953
|
Takes one or more files and/or --glob patterns. A metrics file (*.metrics.yml) is checked
|
|
951
|
-
against metrics spec 0.1.0 and against its model
|
|
954
|
+
against metrics spec 0.1.0 and against its model; a dashboard (*.dashboard.yml) against
|
|
955
|
+
dashboard spec 0.1.0 and the names of the model and metrics beside it, as `dashboard check`
|
|
956
|
+
does. Exits 1 when any file has an error;
|
|
952
957
|
warnings are printed, and the file conforms. A warning that a child's date `can fall
|
|
953
958
|
before` its parent's names the `after: <table>.<column>` to add.
|
|
954
959
|
"""
|
|
@@ -966,6 +971,11 @@ def validate_command(
|
|
|
966
971
|
against: Optional[Path] = None
|
|
967
972
|
if is_metrics_file(file):
|
|
968
973
|
issues, against = _metrics_issues(file, _given(model_option))
|
|
974
|
+
elif dashboards.is_dashboard_file(file):
|
|
975
|
+
found, against, _ = _dashboard_issues(file, _given(model_option), None)
|
|
976
|
+
issues = [
|
|
977
|
+
Issue(issue.path, issue.message, issue.line, issue.severity) for issue in found
|
|
978
|
+
]
|
|
969
979
|
else:
|
|
970
980
|
issues = validate(file)
|
|
971
981
|
if output_format == "github":
|
|
@@ -981,6 +991,11 @@ def validate_command(
|
|
|
981
991
|
typer.echo(
|
|
982
992
|
f"✅ {shown} conforms to metrics spec {METRICS_SPEC_VERSION}{model_note}."
|
|
983
993
|
)
|
|
994
|
+
elif dashboards.is_dashboard_file(file):
|
|
995
|
+
model_note = f", checked against {against.name}" if against is not None else ""
|
|
996
|
+
typer.echo(
|
|
997
|
+
f"✅ {shown} conforms to dashboard spec {dashboards.SPEC_VERSION}{model_note}."
|
|
998
|
+
)
|
|
984
999
|
else:
|
|
985
1000
|
typer.echo(f"✅ {shown} conforms to spec {_spec_of(file)}.")
|
|
986
1001
|
if len(targets) > 1 or output_format == "github":
|
|
@@ -1065,6 +1080,7 @@ class GuideTopic(str, Enum):
|
|
|
1065
1080
|
setup = "setup"
|
|
1066
1081
|
triage = "triage"
|
|
1067
1082
|
tune = "tune"
|
|
1083
|
+
dashboards = "dashboards"
|
|
1068
1084
|
|
|
1069
1085
|
|
|
1070
1086
|
_MODEL_PATTERNS = ("*.model2data.yml", "*.model2data.yaml", "*.model2data.json", "*.dbml")
|
|
@@ -1089,6 +1105,7 @@ def guide_command(
|
|
|
1089
1105
|
"setup: no model here yet -- install, write one, first run. "
|
|
1090
1106
|
"triage: what validate, generate and dbt build printed, and what to do. "
|
|
1091
1107
|
"tune: every option, model key and exit code. "
|
|
1108
|
+
"dashboards: write a *.dashboard.yml over the model's metrics and check it. "
|
|
1092
1109
|
"Default: picked from the current directory (a *.model2data.yml or *.dbml "
|
|
1093
1110
|
"file in it means triage)."
|
|
1094
1111
|
),
|
|
@@ -1237,3 +1254,187 @@ def metrics_export_command(
|
|
|
1237
1254
|
_print_losses(
|
|
1238
1255
|
"Not expressible in Ossie 0.1.1 itself, carried in custom_extensions", export.lossiness
|
|
1239
1256
|
)
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
dashboard_app = typer.Typer(
|
|
1260
|
+
help=(
|
|
1261
|
+
"Dashboards as files (dashboard spec 0.1.0): check a *.dashboard.yml against the "
|
|
1262
|
+
"spec and against the names of its model and metrics. `model2data guide dashboards` "
|
|
1263
|
+
"says how to write one."
|
|
1264
|
+
),
|
|
1265
|
+
no_args_is_help=True,
|
|
1266
|
+
)
|
|
1267
|
+
app.add_typer(dashboard_app, name="dashboard")
|
|
1268
|
+
|
|
1269
|
+
_MODEL_SUFFIXES = (".model2data.yml", ".model2data.yaml", ".model2data.json", ".dbml")
|
|
1270
|
+
_METRICS_SUFFIXES = (".metrics.yml", ".metrics.yaml", ".metrics.json")
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
def _beside(folder: Path, suffixes: tuple[str, ...]) -> list[Path]:
|
|
1274
|
+
"""The files directly in `folder` whose names end in one of `suffixes`, by name."""
|
|
1275
|
+
return sorted(
|
|
1276
|
+
path for path in folder.iterdir() if path.is_file() and path.name.lower().endswith(suffixes)
|
|
1277
|
+
)
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
def _dashboard_model(file: Path, text: str) -> tuple[Optional[Path], Optional[str]]:
|
|
1281
|
+
"""The model a dashboard is checked against when none is given, or why there is none.
|
|
1282
|
+
|
|
1283
|
+
In order: the model the file's `model` names, `<model>.model2data.yml` (or `.yaml`,
|
|
1284
|
+
`.json`, `.dbml`) beside the file; the only model in the dashboard's folder.
|
|
1285
|
+
"""
|
|
1286
|
+
folder = file.parent
|
|
1287
|
+
declared = declared_model(text)
|
|
1288
|
+
if declared:
|
|
1289
|
+
for suffix in _MODEL_SUFFIXES:
|
|
1290
|
+
candidate = folder / f"{declared}{suffix}"
|
|
1291
|
+
if candidate.is_file():
|
|
1292
|
+
return candidate, None
|
|
1293
|
+
models = _beside(folder, _MODEL_SUFFIXES)
|
|
1294
|
+
if len(models) == 1:
|
|
1295
|
+
return models[0], None
|
|
1296
|
+
if models:
|
|
1297
|
+
names = ", ".join(path.name for path in models)
|
|
1298
|
+
return None, (
|
|
1299
|
+
f"several models beside it ({names}), and none named by the file: its metric, "
|
|
1300
|
+
"table and column names are not checked; pass --model to check them"
|
|
1301
|
+
)
|
|
1302
|
+
return None, (
|
|
1303
|
+
"no model beside it: its metric, table and column names are not checked; "
|
|
1304
|
+
"pass --model to check them"
|
|
1305
|
+
)
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
def _dashboard_metrics(model_file: Path) -> Optional[Path]:
|
|
1309
|
+
"""The metrics file beside the model with its stem: coffee.metrics.yml for coffee.dbml."""
|
|
1310
|
+
stem = _model_stem(model_file)
|
|
1311
|
+
for suffix in _METRICS_SUFFIXES:
|
|
1312
|
+
candidate = model_file.with_name(stem + suffix)
|
|
1313
|
+
if candidate.is_file():
|
|
1314
|
+
return candidate
|
|
1315
|
+
return None
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
def _dashboard_issues(
|
|
1319
|
+
file: Path, model_option: Optional[Path], metrics_option: Optional[Path]
|
|
1320
|
+
) -> tuple[list[dashboards.Issue], Optional[Path], Optional[Path]]:
|
|
1321
|
+
"""A dashboard's issues, checked against its model and metrics, and the model and
|
|
1322
|
+
metrics files it was checked against (None where there was none)."""
|
|
1323
|
+
try:
|
|
1324
|
+
text = file.read_bytes().decode("utf-8-sig")
|
|
1325
|
+
except UnicodeDecodeError as error:
|
|
1326
|
+
message = f"{file.name} is not UTF-8 (byte {error.start} cannot be decoded)."
|
|
1327
|
+
return [dashboards.Issue(None, None, message)], None, None
|
|
1328
|
+
notes: list[dashboards.Issue] = []
|
|
1329
|
+
model_file = model_option
|
|
1330
|
+
if model_file is None:
|
|
1331
|
+
model_file, why = _dashboard_model(file, text)
|
|
1332
|
+
if why is not None:
|
|
1333
|
+
notes.append(dashboards.Issue(None, None, why, "warning"))
|
|
1334
|
+
name = dashboards.dashboard_name(file)
|
|
1335
|
+
if dashboards.check_name(name) is not None:
|
|
1336
|
+
notes.append(
|
|
1337
|
+
dashboards.Issue(
|
|
1338
|
+
None,
|
|
1339
|
+
None,
|
|
1340
|
+
f"its file name gives the dashboard the name {name!r}. {dashboards.NAME_RULE}",
|
|
1341
|
+
"warning",
|
|
1342
|
+
)
|
|
1343
|
+
)
|
|
1344
|
+
if model_file is None:
|
|
1345
|
+
return [*notes, *dashboards.check_dashboard(text)], None, None
|
|
1346
|
+
|
|
1347
|
+
try:
|
|
1348
|
+
model = load(model_file)
|
|
1349
|
+
except ModelError:
|
|
1350
|
+
problem = (
|
|
1351
|
+
f"its model, {model_file.name}, does not conform: run `model2data validate "
|
|
1352
|
+
f"{model_file.name}` and fix it first"
|
|
1353
|
+
)
|
|
1354
|
+
return [*notes, dashboards.Issue(None, None, problem)], model_file, None
|
|
1355
|
+
metrics_file = metrics_option or _dashboard_metrics(model_file)
|
|
1356
|
+
found: Optional[Metrics] = None
|
|
1357
|
+
if metrics_file is not None:
|
|
1358
|
+
try:
|
|
1359
|
+
found = load_metrics(metrics_file, model, model_name=_model_stem(model_file))
|
|
1360
|
+
except MetricsError:
|
|
1361
|
+
problem = (
|
|
1362
|
+
f"its metrics file, {metrics_file.name}, does not conform: run `model2data "
|
|
1363
|
+
f"validate {metrics_file.name}` and fix it first"
|
|
1364
|
+
)
|
|
1365
|
+
return [*notes, dashboards.Issue(None, None, problem)], model_file, metrics_file
|
|
1366
|
+
known = dashboards.known_names(model, found, model_name=_model_stem(model_file))
|
|
1367
|
+
return [*notes, *dashboards.check_dashboard(text, known)], model_file, metrics_file
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
def _issue_line(file: Path, issue: dashboards.Issue) -> str:
|
|
1371
|
+
"""`file:line:column: error|warning: message`, without the place when there is none."""
|
|
1372
|
+
where = str(file)
|
|
1373
|
+
if issue.line is not None:
|
|
1374
|
+
where += f":{issue.line}"
|
|
1375
|
+
if issue.column is not None:
|
|
1376
|
+
where += f":{issue.column}"
|
|
1377
|
+
return f"{where}: {issue.severity}: {issue.message}"
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
@dashboard_app.command("check")
|
|
1381
|
+
def dashboard_check_command(
|
|
1382
|
+
files: list[Path] = typer.Argument( # noqa: B008
|
|
1383
|
+
...,
|
|
1384
|
+
exists=True,
|
|
1385
|
+
file_okay=True,
|
|
1386
|
+
dir_okay=False,
|
|
1387
|
+
readable=True,
|
|
1388
|
+
help="The dashboards: *.dashboard.yml files.",
|
|
1389
|
+
),
|
|
1390
|
+
model_option: Optional[Path] = typer.Option( # noqa: B008
|
|
1391
|
+
None,
|
|
1392
|
+
"--model",
|
|
1393
|
+
"-m",
|
|
1394
|
+
exists=True,
|
|
1395
|
+
file_okay=True,
|
|
1396
|
+
dir_okay=False,
|
|
1397
|
+
readable=True,
|
|
1398
|
+
help=(
|
|
1399
|
+
"The model whose tables and columns the dashboards name. Default: "
|
|
1400
|
+
"<model>.model2data.yml (or .dbml) beside the file for the `model` it names, "
|
|
1401
|
+
"else the only model beside the file."
|
|
1402
|
+
),
|
|
1403
|
+
),
|
|
1404
|
+
metrics_option: Optional[Path] = typer.Option( # noqa: B008
|
|
1405
|
+
None,
|
|
1406
|
+
"--metrics",
|
|
1407
|
+
exists=True,
|
|
1408
|
+
file_okay=True,
|
|
1409
|
+
dir_okay=False,
|
|
1410
|
+
readable=True,
|
|
1411
|
+
help=(
|
|
1412
|
+
"The model's metrics file. Default: <stem>.metrics.yml beside the model, else "
|
|
1413
|
+
"the metrics the model implies."
|
|
1414
|
+
),
|
|
1415
|
+
),
|
|
1416
|
+
):
|
|
1417
|
+
"""Check dashboards against dashboard spec 0.1.0 and the names of their model and metrics.
|
|
1418
|
+
|
|
1419
|
+
Prints `file:line:column: error|warning: message` per issue, then a summary line per
|
|
1420
|
+
file. An error is a way the file does not conform; a metric, `table.column` or table the
|
|
1421
|
+
model does not have is a warning. Exits 1 when any file has an error, 0 otherwise.
|
|
1422
|
+
"""
|
|
1423
|
+
failed = False
|
|
1424
|
+
for file in files:
|
|
1425
|
+
issues, model_file, metrics_file = _dashboard_issues(
|
|
1426
|
+
file, _given(model_option), _given(metrics_option)
|
|
1427
|
+
)
|
|
1428
|
+
for issue in issues:
|
|
1429
|
+
typer.echo(_issue_line(file, issue))
|
|
1430
|
+
errors = sum(1 for issue in issues if issue.is_error)
|
|
1431
|
+
warnings = len(issues) - errors
|
|
1432
|
+
failed = failed or errors > 0
|
|
1433
|
+
against = [path.name for path in (model_file, metrics_file) if path is not None]
|
|
1434
|
+
note = f", checked against {' and '.join(against)}" if against else ""
|
|
1435
|
+
typer.echo(
|
|
1436
|
+
f"{file}: {errors} error{'' if errors == 1 else 's'}, "
|
|
1437
|
+
f"{warnings} warning{'' if warnings == 1 else 's'}{note}"
|
|
1438
|
+
)
|
|
1439
|
+
if failed:
|
|
1440
|
+
raise typer.Exit(1)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Dashboards as files: dashboard spec 0.1.0, read, checked and written.
|
|
2
|
+
|
|
3
|
+
A dashboard file is `<name>.dashboard.yml`, as `model2data/spec/dashboards/README.md`
|
|
4
|
+
and `dashboard.schema.json` define it: pages of tiles on a 12-column grid, each
|
|
5
|
+
tile naming a metric, a `table.column` or a table of a model2data model, never a
|
|
6
|
+
data source or a value. The engine does not draw a dashboard or compute its
|
|
7
|
+
numbers; it reads, checks and writes the file. model2data studio draws it with
|
|
8
|
+
the numbers of the model's generated data.
|
|
9
|
+
|
|
10
|
+
>>> from model2data import dashboards, metrics
|
|
11
|
+
>>> from model2data.model import load as load_model
|
|
12
|
+
>>> model = load_model("coffee_webshop.model2data.yml")
|
|
13
|
+
>>> found = metrics.load("coffee_webshop.metrics.yml", model)
|
|
14
|
+
>>> known = dashboards.known_names(model, found) # metrics, tables, columns
|
|
15
|
+
>>> for issue in dashboards.check_dashboard("coffee_webshop_sales.dashboard.yml", known):
|
|
16
|
+
... print(issue.line, issue.column, issue.severity, issue.message)
|
|
17
|
+
>>> board = dashboards.read_dashboard("coffee_webshop_sales.dashboard.yml", known) # DashboardError on errors
|
|
18
|
+
>>> board.pages[0].tiles[0].metric, board.warnings
|
|
19
|
+
>>> text = dashboards.write_dashboard(board) # the canonical file
|
|
20
|
+
|
|
21
|
+
An error is a way the file does not conform (bad YAML, an unknown key, a
|
|
22
|
+
missing or repeated id, a value out of range). A warning is a name `known`
|
|
23
|
+
does not hold, or a tile running past the grid's right edge: the file still
|
|
24
|
+
conforms. Every issue has a 1-based `line` and `column` when it was read from
|
|
25
|
+
text.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from model2data.dashboards.check import schema
|
|
29
|
+
from model2data.dashboards.reader import (
|
|
30
|
+
check_dashboard,
|
|
31
|
+
check_name,
|
|
32
|
+
dashboard_name,
|
|
33
|
+
from_dict,
|
|
34
|
+
is_dashboard_file,
|
|
35
|
+
known_names,
|
|
36
|
+
read_dashboard,
|
|
37
|
+
)
|
|
38
|
+
from model2data.dashboards.types import (
|
|
39
|
+
GRAINS,
|
|
40
|
+
GRID_COLUMNS,
|
|
41
|
+
KINDS,
|
|
42
|
+
MAX_BYTES,
|
|
43
|
+
MAX_COLUMNS,
|
|
44
|
+
MAX_NAME,
|
|
45
|
+
MAX_PAGES,
|
|
46
|
+
MAX_TABLE_ROWS,
|
|
47
|
+
MAX_TEXT,
|
|
48
|
+
MAX_TILES,
|
|
49
|
+
NAME_RULE,
|
|
50
|
+
SCHEMA_URL,
|
|
51
|
+
SPEC_VERSION,
|
|
52
|
+
TILE_FIELDS,
|
|
53
|
+
Dashboard,
|
|
54
|
+
DashboardError,
|
|
55
|
+
Issue,
|
|
56
|
+
Known,
|
|
57
|
+
Page,
|
|
58
|
+
Place,
|
|
59
|
+
Tile,
|
|
60
|
+
)
|
|
61
|
+
from model2data.dashboards.writer import write_dashboard
|
|
62
|
+
|
|
63
|
+
__all__ = [
|
|
64
|
+
"GRAINS",
|
|
65
|
+
"GRID_COLUMNS",
|
|
66
|
+
"KINDS",
|
|
67
|
+
"MAX_BYTES",
|
|
68
|
+
"MAX_COLUMNS",
|
|
69
|
+
"MAX_NAME",
|
|
70
|
+
"MAX_PAGES",
|
|
71
|
+
"MAX_TABLE_ROWS",
|
|
72
|
+
"MAX_TEXT",
|
|
73
|
+
"MAX_TILES",
|
|
74
|
+
"NAME_RULE",
|
|
75
|
+
"SCHEMA_URL",
|
|
76
|
+
"SPEC_VERSION",
|
|
77
|
+
"TILE_FIELDS",
|
|
78
|
+
"Dashboard",
|
|
79
|
+
"DashboardError",
|
|
80
|
+
"Issue",
|
|
81
|
+
"Known",
|
|
82
|
+
"Page",
|
|
83
|
+
"Place",
|
|
84
|
+
"Tile",
|
|
85
|
+
"check_dashboard",
|
|
86
|
+
"check_name",
|
|
87
|
+
"dashboard_name",
|
|
88
|
+
"from_dict",
|
|
89
|
+
"is_dashboard_file",
|
|
90
|
+
"known_names",
|
|
91
|
+
"read_dashboard",
|
|
92
|
+
"schema",
|
|
93
|
+
"write_dashboard",
|
|
94
|
+
]
|