Skip to content

Commit

Permalink
Added group properties to dbt_project.yml files (#94)
Browse files Browse the repository at this point in the history
* Added 'group' property for model_configs in dbt_project.yml

* Added group defs and fixed tests for model_configs

* All node_types

* Added group to seed, snapshot and test_configs

* Revert tests changes

* add group to resources yml for those that can be grouped

* restore 1.6, add groups

* typo

* turns out semantic models are 1.7+

* add tests

* revert groups in default path, as it's used for <1.4 and groups are 1.5+

* make group a ref

---------

Co-authored-by: Dave Connors <[email protected]>
  • Loading branch information
evgeniybobok and dave-connors-3 authored Oct 31, 2023
1 parent d9365db commit 13831bd
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 3 deletions.
33 changes: 33 additions & 0 deletions schemas/1.5/dbt_project-1.5.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,18 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+group": {
"$ref": "#/$defs/group"
},
"+treat_null_values_as_zero": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"group": {
"$ref": "#/$defs/group"
},
"treat_null_values_as_zero": {
"$ref": "#/$defs/boolean_or_jinja_string"
}
Expand Down Expand Up @@ -292,6 +298,9 @@
"+grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"+group": {
"$ref": "#/$defs/group"
},
"+hours_to_expiration": {
"$ref": "#/$defs/hours_to_expiration"
},
Expand Down Expand Up @@ -365,6 +374,9 @@
"grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"group": {
"$ref": "#/$defs/group"
},
"hours_to_expiration": {
"$ref": "#/$defs/hours_to_expiration"
},
Expand Down Expand Up @@ -451,6 +463,9 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+group": {
"$ref": "#/$defs/group"
},
"+meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -481,6 +496,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"group": {
"$ref": "#/$defs/group"
},
"meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -536,6 +554,9 @@
"+grants": {
"$ref": "#/$defs/grants"
},
"+group": {
"$ref": "#/$defs/group"
},
"+meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -584,6 +605,9 @@
"grants": {
"$ref": "#/$defs/grants"
},
"group": {
"$ref": "#/$defs/group"
},
"meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -696,6 +720,9 @@
"+fail_calc": {
"$ref": "#/$defs/fail_calc"
},
"+group": {
"$ref": "#/$defs/group"
},
"+limit": {
"$ref": "#/$defs/limit"
},
Expand Down Expand Up @@ -726,6 +753,9 @@
"fail_calc": {
"$ref": "#/$defs/fail_calc"
},
"group": {
"$ref": "#/$defs/group"
},
"limit": {
"$ref": "#/$defs/limit"
},
Expand Down Expand Up @@ -788,6 +818,9 @@
"additionalProperties": false
}
},
"group": {
"type": "string"
},
"hours_to_expiration": {
"type": "number",
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table."
Expand Down
19 changes: 17 additions & 2 deletions schemas/1.5/dbt_yml_files-1.5.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"type": "boolean"
}
}
},
"group": {
"$ref": "#/$defs/group"
}
}
}
Expand Down Expand Up @@ -219,7 +222,7 @@
"$ref": "#/$defs/boolean_or_jinja_string"
},
"group": {
"type": "string"
"$ref": "#/$defs/group"
}
}
},
Expand Down Expand Up @@ -254,6 +257,9 @@
"additionalProperties": false
}
},
"group": {
"$ref": "#/$defs/group"
},
"label": {
"type": "string"
},
Expand Down Expand Up @@ -326,7 +332,7 @@
}
},
"group": {
"type": "string"
"$ref": "#/$defs/group"
},
"latest_version": {
"type": "number"
Expand Down Expand Up @@ -421,6 +427,9 @@
}
}
},
"group": {
"$ref": "#/$defs/group"
},
"tests": {
"type": "array",
"items": {
Expand Down Expand Up @@ -504,6 +513,9 @@
}
}
},
"group": {
"$ref": "#/$defs/group"
},
"meta": {
"type": "object"
},
Expand Down Expand Up @@ -789,6 +801,9 @@
},
"additionalProperties": false
},
"group": {
"type": "string"
},
"include_exclude": {
"type": "object",
"properties": {
Expand Down
27 changes: 27 additions & 0 deletions schemas/1.6/dbt_project-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@
"+grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"+group": {
"$ref": "#/$defs/group"
},
"+hours_to_expiration": {
"$ref": "#/$defs/hours_to_expiration"
},
Expand Down Expand Up @@ -333,6 +336,9 @@
"grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"group": {
"$ref": "#/$defs/group"
},
"hours_to_expiration": {
"$ref": "#/$defs/hours_to_expiration"
},
Expand Down Expand Up @@ -419,6 +425,9 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+group": {
"$ref": "#/$defs/group"
},
"+meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -449,6 +458,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"group": {
"$ref": "#/$defs/group"
},
"meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -504,6 +516,9 @@
"+grants": {
"$ref": "#/$defs/grants"
},
"+group": {
"$ref": "#/$defs/group"
},
"+meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -552,6 +567,9 @@
"grants": {
"$ref": "#/$defs/grants"
},
"group": {
"$ref": "#/$defs/group"
},
"meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -664,6 +682,9 @@
"+fail_calc": {
"$ref": "#/$defs/fail_calc"
},
"+group": {
"$ref": "#/$defs/group"
},
"+limit": {
"$ref": "#/$defs/limit"
},
Expand Down Expand Up @@ -694,6 +715,9 @@
"fail_calc": {
"$ref": "#/$defs/fail_calc"
},
"group": {
"$ref": "#/$defs/group"
},
"limit": {
"$ref": "#/$defs/limit"
},
Expand Down Expand Up @@ -756,6 +780,9 @@
"additionalProperties": false
}
},
"group": {
"type": "string"
},
"hours_to_expiration": {
"type": "number",
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table."
Expand Down
17 changes: 16 additions & 1 deletion schemas/1.6/dbt_yml_files-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"type": "boolean"
}
}
},
"group": {
"$ref": "#/$defs/group"
}
}
}
Expand Down Expand Up @@ -196,6 +199,9 @@
"filter": {
"type": "string"
},
"group": {
"$ref": "#/$defs/group"
},
"label": {
"type": "string"
},
Expand Down Expand Up @@ -259,7 +265,7 @@
}
},
"group": {
"type": "string"
"$ref": "#/$defs/group"
},
"latest_version": {
"type": "number"
Expand Down Expand Up @@ -354,6 +360,9 @@
}
}
},
"group": {
"$ref": "#/$defs/group"
},
"tests": {
"type": "array",
"items": {
Expand Down Expand Up @@ -488,6 +497,9 @@
}
}
},
"group": {
"$ref": "#/$defs/group"
},
"meta": {
"type": "object"
},
Expand Down Expand Up @@ -880,6 +892,9 @@
},
"additionalProperties": false
},
"group": {
"type": "string"
},
"include_exclude": {
"type": "object",
"properties": {
Expand Down
2 changes: 2 additions & 0 deletions tests/1.5/valid/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ models:
materialized: table
empty_subdirectory:
another_one:
+group: real
meta:
owner: Tony
contracted_models:
Expand All @@ -56,6 +57,7 @@ models:
jinja_key: "{{ target.name }}"

seeds:
+group: sunflower
test:
+enabled: false
empty_subdirectory:
Expand Down
5 changes: 5 additions & 0 deletions tests/1.6/invalid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ models:
- unique
- not_null

semantic_models:
- model: ref('models')
name: model
group: farmhands_only

metrics:
- name: new_customers
label: New Customers marked 'paying'
Expand Down
1 change: 1 addition & 0 deletions tests/1.6/valid/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ models:
materialized: table
empty_subdirectory:
another_one:
+group: real
meta:
owner: Tony
contracted_models:
Expand Down
1 change: 1 addition & 0 deletions tests/1.6/valid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ models:

snapshots:
- name: snapshot_name
group: analytics
description: slowly changing dimension
columns:
- name: id
Expand Down

0 comments on commit 13831bd

Please sign in to comment.