Comments (4)
Hi @swanderz ! That is indeed a bit obtuse. The idea was to be able to test grouped expressions across multiple models. So, say you wanted to test counts by order_date
across two models, you could group on order_date
. And unfortunately, I don't think this group_by
feature is actually used by any of the expectations in this package (yet), so there's no good example, although I use equal_expression
directly in one of my project this way.
Rather than conditionally grouping when there is a group_by
being passed, I simply always group the expression. The default is simply a string col
which acts as a dummy grouping variable. This works fine on all the platforms I've been testing.
However, if T-SQL barfs on this, you could probably override get_select
(which is already an adapter macro) and only actually group when there is a non-default grouping value. I'd also be happy to help update the default version to be more explicit when there is no grouping. Does that make sense?
from dbt-expectations.
Just looking through the code again, I also use this fake column to join the two expression results. So, if there are no columns to group by and you just have two scalar results, like counts for example, I can still join and compare the two without having to change the join type to a cross join.
from dbt-expectations.
@swanderz take a look at #63 to see if that makes more sense. It's just a quick take on making this more explicit. Btw, there are a couple of direct integration tests against equal_expression
that take advantage of group_by
.
Does a cross join b
work in T-SQL, or do you do a, b
there?
from dbt-expectations.
In T-SQL a cross join b
should work fine, yes
from dbt-expectations.
Related Issues (20)
- [BUG] The quote: parameter in the model .yaml breaks the expect_column_to_exist() macro.
- [Feature Request] Add suport for AWS Athena HOT 1
- [BUG] Invalid SQL compiled when extracting relation columns from duckdb adapter
- [Feature Request] Improving Data Validation Output HOT 1
- [BUG] expect_multicolumn_sum_to_equal fails if sum_total is another column
- Trino support
- [BUG] expect_row_values_to_have_data_for_every_n_datepart can fail if model has never been run HOT 3
- [Feature Request] Add variable for row_cnt for expect_row_values_to_have_data_for_every_n_datepart test
- [BUG] With expect expect_column_values_to_be_of_type test
- [BUG] expect_select_column_values_to_be_unique_within_record Doesn't Allow for Different Data Types
- [BUG] Table columns names that contain spaces trigger runtime errors.
- Improve performance by moving to count(1) instead of count(*)
- [BUG] expect_table_aggregation_to_equal_other_table doesn't work with dates HOT 1
- expect_column_proportion_of_unique_values_to_be_between throwing a compilation error HOT 3
- [Documentation] Small spelling error
- [Feature Request] Test against empty string character / text columns
- [Feature Request] Enable description tag for tests HOT 5
- [BUG] Issue in expect_column_values_to_be_of_type for field under source HOT 1
- [Feature Request] Allow defining the step between values on increasing/decreasing tests
- expect_column_values_to_be_decreasing uses wrong order when sorting
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-expectations.