Skip to content

Commit

Permalink
Update README, add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
clausherther committed Apr 22, 2021
1 parent 41171fb commit fcbf250
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,31 @@ tests:
interval: 1
```

#### [expect_grouped_row_values_to_have_recent_data](macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql)

Expect the model to have **grouped** rows that are at least as recent as the defined interval prior to the current timestamp.
Uuse this to test whether there is recent data for each grouped row defined by `group_by` (which is a list of columns) and a `timestamp_column`.

*Applies to:* Model, Seed, Source

```yaml
models: # or seeds:
- name : my_model
tests :
- dbt_expectations.expect_grouped_row_values_to_have_recent_data:
group_by: [group_id]
timestamp_column: date_day
datepart: day
interval: 1
# or also:
- dbt_expectations.expect_grouped_row_values_to_have_recent_data:
group_by: [group_id, other_group_id]
timestamp_column: date_day
datepart: day
interval: 1
```


#### [expect_table_column_count_to_be_between](macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql)

Expect the number of columns in a model to be between two values.
Expand Down
5 changes: 5 additions & 0 deletions integration_tests/models/schema_tests/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,9 @@ models:
timestamp_column: date_day
datepart: day
interval: 1
- dbt_expectations.expect_grouped_row_values_to_have_recent_data:
group_by: [group_id, row_value]
timestamp_column: date_day
datepart: day
interval: 1

0 comments on commit fcbf250

Please sign in to comment.