Comments (4)
Here's the use-case for it:
We use dbt
to populate databases of a web-application. There are specific moments where these are ran, and they populate data to initiate some business processes in the application. I plan on having several table-wide tests, to guarantee data consistency, before web-app processes are initiated, but these tests will most definitely not be generic - one, perhaps more dedicated tests per table. Thus, singular data tests.
Now, because the data may be inconsistent (I'm loading it from several source systems which may serve out-of-sync, or corrupted information), I'd like to run dbt test
and get a report of failures and warnings to show to the users when the process fails. These messages should be human readable. Names such as dbt_expectations_expect_column_values_to_be_between_users_user_details_age__120__0
are hardly readable for someone who doesn't work with DBT, and definitely not suited to be shown in an otherwise pretty Web UI.
So I thought I could name the tests using the name
attribute, and while it works for generic tests in models.yml
, I cannot make it work for singular tests in /test
folder.
As a workaround:
- I can, of course, name the file
Example assertion with custom name.sql
instead ofassert_example.sql
, and that seems to do what I want, but requires me to have whitespace in filenames (which I'm not too keen of). - I also can refactor my dedicated tests into generic ones, and invoke them from
models.yml
. This has the advantage of having all tests specified in a single place. It's just bending the tool to my needs instead of using it properly...
from dbt-core.
Thanks for describing your use case and what you ran into @mkielar !
The docs you referenced only applies to the tests
property within models, which are generic data tests (rather than including singular data tests as well). So I'm going to re-label this as a feature request.
I buy it that you should be able to customize the name
for singular data tests just like they can be customized for generic data tests.
Since we'd be unable to prioritize this ourselves any time soon, I'm going to mark this as "help wanted".
from dbt-core.
Hey @dbeatty10 ,
Is this something I can dip my toe in? Keen to contribute to dbt-core
from dbt-core.
@dbeatty10 @mkielar I'm more than happy to throw my name in the hat for this (with a little guidance). Roughly this requirement has come up at my work so fixing at source seems smarter than whatever terrible ideas I had for tackling this locally.
from dbt-core.
Related Issues (20)
- fully remove support - we should not support spaces in model names
- [Feature] [Spike+] scope the warning on tests directory to just the root package
- [Bug] DBT docs erroneously complains about duplicate definition of resources HOT 5
- [Feature] Allow `dbt show` to output json data without extra logs (by updating `--quiet`) HOT 8
- [Feature] document a materialization HOT 1
- [Feature] Support on_config_change for incremental HOT 6
- [Feature] Use `--quiet` by default for `dbt show`
- A tests: key of None/Null at the model level fails parsing validation in 1.7, but didn't in 1.4 HOT 7
- [Bug] Can't upgrade to 1.8 HOT 2
- DBT snapshot with user defined `dbt_valid_from` and `dbt_valid_to` and `dbt_updated_at` HOT 1
- [Feature] Improve Semantic Manifest parsing error message HOT 2
- Not able to get columns for source, when defining unit test on a model that depends on source HOT 1
- [Bug] Line Comment after config and Jinja call/set functions causes incorrect compilation of sql HOT 1
- [Feature] I need to put a time delay in my model ( kind of sleep in python ) HOT 6
- [Bug] Fix query comments test
- [Feature] Allow `args` flag to be passed to `run-operation` HOT 3
- [Feature] Cost Optimisation: zero-cost tests via inlining into table creation using Error(...) HOT 3
- Write a unittest for get_full_manifest HOT 1
- Write a unittest for partial parse HOT 1
- [SPIKE+] Make a plan for how to write a unittest for ModelRunner HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-core.