Skip to content

Commit 4fe009c

Browse files
committed
feat: Add semantic-models as valid top-level key in dbt_project.yml
- Add semantic-models property to dbt_project schema (latest, 1.7, 1.6, generic) - Add semantic_model_configs definition with enabled, group, and meta properties (per dbt docs: https://docs.getdbt.com/docs/build/semantic-models) - Add group definition to generic dbt_project.json schema - Update valid test files with semantic-models example configuration Semantic models were introduced in dbt 1.6, so schemas for 1.5 are unchanged.
1 parent e8439b5 commit 4fe009c

File tree

7 files changed

+176
-0
lines changed

7 files changed

+176
-0
lines changed

schemas/1.6/dbt_project-1.6.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@
139139
"seeds": {
140140
"$ref": "#/$defs/seed_configs"
141141
},
142+
"semantic-models": {
143+
"$ref": "#/$defs/semantic_model_configs"
144+
},
142145
"snapshot-paths": {
143146
"$ref": "#/$defs/array_of_strings"
144147
},
@@ -832,6 +835,41 @@
832835
]
833836
}
834837
},
838+
"semantic_model_configs": {
839+
"title": "Semantic model configs",
840+
"description": "Configurations set in the dbt_project.yml file will apply to all semantic models that don't have a more specific configuration set.",
841+
"type": "object",
842+
"properties": {
843+
"+enabled": {
844+
"$ref": "#/$defs/boolean_or_jinja_string"
845+
},
846+
"+group": {
847+
"$ref": "#/$defs/group"
848+
},
849+
"+meta": {
850+
"$ref": "#/$defs/meta"
851+
},
852+
"enabled": {
853+
"$ref": "#/$defs/boolean_or_jinja_string"
854+
},
855+
"group": {
856+
"$ref": "#/$defs/group"
857+
},
858+
"meta": {
859+
"$ref": "#/$defs/meta"
860+
}
861+
},
862+
"additionalProperties": {
863+
"oneOf": [
864+
{
865+
"$ref": "#/$defs/semantic_model_configs"
866+
},
867+
{
868+
"$ref": "#/$defs/empty_directory"
869+
}
870+
]
871+
}
872+
},
835873
"sql_header": {
836874
"type": "string"
837875
},

schemas/1.7/dbt_project-1.7.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
"seeds": {
135135
"$ref": "#/$defs/seed_configs"
136136
},
137+
"semantic-models": {
138+
"$ref": "#/$defs/semantic_model_configs"
139+
},
137140
"snapshot-paths": {
138141
"$ref": "#/$defs/array_of_strings"
139142
},
@@ -735,6 +738,41 @@
735738
]
736739
}
737740
},
741+
"semantic_model_configs": {
742+
"title": "Semantic model configs",
743+
"description": "Configurations set in the dbt_project.yml file will apply to all semantic models that don't have a more specific configuration set.",
744+
"type": "object",
745+
"properties": {
746+
"+enabled": {
747+
"$ref": "#/$defs/boolean_or_jinja_string"
748+
},
749+
"+group": {
750+
"$ref": "#/$defs/group"
751+
},
752+
"+meta": {
753+
"$ref": "#/$defs/meta"
754+
},
755+
"enabled": {
756+
"$ref": "#/$defs/boolean_or_jinja_string"
757+
},
758+
"group": {
759+
"$ref": "#/$defs/group"
760+
},
761+
"meta": {
762+
"$ref": "#/$defs/meta"
763+
}
764+
},
765+
"additionalProperties": {
766+
"oneOf": [
767+
{
768+
"$ref": "#/$defs/semantic_model_configs"
769+
},
770+
{
771+
"$ref": "#/$defs/empty_directory"
772+
}
773+
]
774+
}
775+
},
738776
"string_or_array_of_strings": {
739777
"oneOf": [
740778
{

schemas/dbt_project.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@
133133
"seeds": {
134134
"$ref": "#/$defs/seed_configs"
135135
},
136+
"semantic-models": {
137+
"$ref": "#/$defs/semantic_model_configs"
138+
},
136139
"snapshot-paths": {
137140
"$ref": "#/$defs/array_of_strings"
138141
},
@@ -255,6 +258,9 @@
255258
},
256259
"additionalProperties": false
257260
},
261+
"group": {
262+
"type": "string"
263+
},
258264
"hours_to_expiration": {
259265
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table.",
260266
"type": "number"
@@ -799,6 +805,41 @@
799805
]
800806
}
801807
},
808+
"semantic_model_configs": {
809+
"title": "Semantic model configs",
810+
"description": "Configurations set in the dbt_project.yml file will apply to all semantic models that don't have a more specific configuration set.",
811+
"type": "object",
812+
"properties": {
813+
"+enabled": {
814+
"$ref": "#/$defs/boolean_or_jinja_string"
815+
},
816+
"+group": {
817+
"$ref": "#/$defs/group"
818+
},
819+
"+meta": {
820+
"$ref": "#/$defs/meta"
821+
},
822+
"enabled": {
823+
"$ref": "#/$defs/boolean_or_jinja_string"
824+
},
825+
"group": {
826+
"$ref": "#/$defs/group"
827+
},
828+
"meta": {
829+
"$ref": "#/$defs/meta"
830+
}
831+
},
832+
"additionalProperties": {
833+
"oneOf": [
834+
{
835+
"$ref": "#/$defs/semantic_model_configs"
836+
},
837+
{
838+
"$ref": "#/$defs/empty_directory"
839+
}
840+
]
841+
}
842+
},
802843
"sql_header": {
803844
"type": "string"
804845
},

schemas/latest/dbt_project-latest.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@
216216
"seeds": {
217217
"$ref": "#/$defs/seed_configs"
218218
},
219+
"semantic-models": {
220+
"$ref": "#/$defs/semantic_model_configs"
221+
},
219222
"snapshot-paths": {
220223
"$ref": "#/$defs/array_of_strings"
221224
},
@@ -890,6 +893,41 @@
890893
]
891894
}
892895
},
896+
"semantic_model_configs": {
897+
"title": "Semantic model configs",
898+
"description": "Configurations set in the dbt_project.yml file will apply to all semantic models that don't have a more specific configuration set.",
899+
"type": "object",
900+
"properties": {
901+
"+enabled": {
902+
"$ref": "#/$defs/boolean_or_jinja_string"
903+
},
904+
"+group": {
905+
"$ref": "#/$defs/group"
906+
},
907+
"+meta": {
908+
"$ref": "#/$defs/meta"
909+
},
910+
"enabled": {
911+
"$ref": "#/$defs/boolean_or_jinja_string"
912+
},
913+
"group": {
914+
"$ref": "#/$defs/group"
915+
},
916+
"meta": {
917+
"$ref": "#/$defs/meta"
918+
}
919+
},
920+
"additionalProperties": {
921+
"oneOf": [
922+
{
923+
"$ref": "#/$defs/semantic_model_configs"
924+
},
925+
{
926+
"$ref": "#/$defs/empty_directory"
927+
}
928+
]
929+
}
930+
},
893931
"severity": {
894932
"oneOf": [
895933
{

tests/1.6/valid/dbt_project.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ sources:
100100
+enabled: true
101101
empty_subdirectory:
102102

103+
semantic-models:
104+
my_project:
105+
+enabled: true
106+
+group: analytics
107+
+meta:
108+
team: data-platform
109+
103110
quoting:
104111
database: true
105112
schema: true

tests/1.7/valid/dbt_project.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ sources:
100100
+enabled: true
101101
empty_subdirectory:
102102

103+
semantic-models:
104+
my_project:
105+
+enabled: true
106+
+group: analytics
107+
+meta:
108+
team: data-platform
109+
103110
quoting:
104111
database: true
105112
schema: true

tests/latest/valid/dbt_project.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ sources:
110110
+enabled: true
111111
empty_subdirectory:
112112

113+
semantic-models:
114+
my_project:
115+
+enabled: true
116+
+group: analytics
117+
+meta:
118+
team: data-platform
119+
113120
quoting:
114121
database: true
115122
schema: true

0 commit comments

Comments
 (0)