Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype: test materialization that allows materialization to be set in the config() #8748

Closed
wants to merge 3 commits into from

Conversation

dbeatty10
Copy link
Contributor

@dbeatty10 dbeatty10 commented Sep 29, 2023

regarding #6914

🚧 This is a prototype. It currently includes logging statements an inline comments for demo purposes.

Problem

The failures of dbt tests can only be done ephemerally or stored in a table stored in a table; there is no way to capture test results as a view or a materialized view. So users need to re-run dbt test (or dbt build) to see the results that are up-to-date. Of course those results can immediately go stale 😬

Solution

Big idea

Enable test results as a view or a materialized view via the materialized config so that they will always show the current failures without the need to run dbt.

Users can specify the materialization within the config block in their tests like any the following:

  • materialized="table" (isomorphic to --store-failures)
  • materialized="view" NEW
  • materialized="materialized_view" NEW

Implementation details

Flesh out the ideas in this Loom by combining #8653 with the approach used by the clone materialization (introduced in #7881).

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label Sep 29, 2023
@github-actions
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (408a789) 86.65% compared to head (656a101) 83.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8748      +/-   ##
==========================================
- Coverage   86.65%   83.02%   -3.64%     
==========================================
  Files         176      176              
  Lines       25772    25767       -5     
==========================================
- Hits        22332    21392     -940     
- Misses       3440     4375     +935     
Flag Coverage Δ
integration 79.08% <ø> (-4.33%) ⬇️
unit 65.13% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
core/dbt/contracts/graph/model_config.py 89.07% <ø> (-3.12%) ⬇️
core/dbt/task/test.py 89.62% <ø> (-5.67%) ⬇️

... and 55 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbeatty10
Copy link
Contributor Author

Closing since this was just a prototype to support #8653

@dbeatty10 dbeatty10 closed this Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant