Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grants #98

Merged
merged 6 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions schemas/1.5/dbt_project-1.5.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@
"+grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"+grants": {
"$ref": "#/$defs/grants"
},
"+group": {
"$ref": "#/$defs/group"
},
Expand Down Expand Up @@ -374,6 +377,9 @@
"grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"grants": {
"$ref": "#/$defs/grants"
},
"group": {
"$ref": "#/$defs/group"
},
Expand Down Expand Up @@ -463,6 +469,9 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+grants": {
"$ref": "#/$defs/grants"
},
"+group": {
"$ref": "#/$defs/group"
},
Expand Down Expand Up @@ -496,6 +505,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"$ref": "#/$defs/grants"
},
"group": {
"$ref": "#/$defs/group"
},
Expand Down Expand Up @@ -818,6 +830,16 @@
"additionalProperties": false
}
},
"grants": {
"type": "object",
"description": "flexible grant config. accepts any string key, expects a string or list of strings value",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The various IDEs should take responsibility for saying what the type is. The description would be better if it was what the strings actually are (what is granted, to whom it is granted)

"patternProperties": {
".*": {
"$ref": "#/$defs/string_or_array_of_strings"
}
},
"additionalProperties": false
},
"group": {
"type": "string"
},
Expand Down Expand Up @@ -862,9 +884,6 @@
"alias": {
"type": "string"
},
"grants": {
"type": "object"
},
"strategy": {
"type": "string"
},
Expand Down
18 changes: 17 additions & 1 deletion schemas/1.5/dbt_yml_files-1.5.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"$ref": "#/$defs/grants"
},
"quote_columns": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
Expand Down Expand Up @@ -468,7 +471,7 @@
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"type": "object"
"$ref": "#/$defs/grants"
},
"persist_docs": {
"$ref": "#/$defs/persist_docs_config"
Expand Down Expand Up @@ -801,6 +804,16 @@
},
"additionalProperties": false
},
"grants": {
"type": "object",
"description": "flexible grant config. accepts any string key, expects a string or list of strings value",
"patternProperties": {
".*": {
"$ref": "#/$defs/string_or_array_of_strings"
}
},
"additionalProperties": false
},
"group": {
"type": "string"
},
Expand Down Expand Up @@ -851,6 +864,9 @@
"additionalProperties": false
}
},
"grants": {
"$ref": "#/$defs/grants"
},
"hours_to_expiration": {
"type": "number",
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table."
Expand Down
25 changes: 22 additions & 3 deletions schemas/1.6/dbt_project-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+grants": {
"$ref": "#/$defs/grants"
},
"+file_format": {
"$ref": "#/$defs/file_format"
},
Expand Down Expand Up @@ -330,6 +333,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"$ref": "#/$defs/grants"
},
"file_format": {
"$ref": "#/$defs/file_format"
},
Expand Down Expand Up @@ -425,6 +431,9 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+grants": {
"$ref": "#/$defs/grants"
},
"+group": {
"$ref": "#/$defs/group"
},
Expand Down Expand Up @@ -458,6 +467,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"$ref": "#/$defs/grants"
},
"group": {
"$ref": "#/$defs/group"
},
Expand Down Expand Up @@ -780,6 +792,16 @@
"additionalProperties": false
}
},
"grants": {
"type": "object",
"description": "flexible grant config. accepts any string key, expects a string or list of strings value",
"patternProperties": {
".*": {
"$ref": "#/$defs/string_or_array_of_strings"
}
},
"additionalProperties": false
},
"group": {
"type": "string"
},
Expand Down Expand Up @@ -824,9 +846,6 @@
"alias": {
"type": "string"
},
"grants": {
"type": "object"
},
"strategy": {
"type": "string"
},
Expand Down
20 changes: 18 additions & 2 deletions schemas/1.6/dbt_yml_files-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants" : {
"$ref": "#/$defs/grants"
},
"quote_columns": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
Expand Down Expand Up @@ -451,8 +454,8 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"type": "object"
"grants" : {
"$ref": "#/$defs/grants"
},
"persist_docs": {
"$ref": "#/$defs/persist_docs_config"
Expand Down Expand Up @@ -892,6 +895,16 @@
},
"additionalProperties": false
},
"grants": {
"type": "object",
"description": "flexible grant config. accepts any string key, expects a string or list of strings value",
"patternProperties": {
".*": {
"$ref": "#/$defs/string_or_array_of_strings"
}
},
"additionalProperties": false
},
"group": {
"type": "string"
},
Expand Down Expand Up @@ -1078,6 +1091,9 @@
"additionalProperties": false
}
},
"grants" : {
"$ref": "#/$defs/grants"
},
"hours_to_expiration": {
"type": "number",
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table."
Expand Down
25 changes: 22 additions & 3 deletions schemas/dbt_project.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@
"+grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"+grants": {
"$ref": "#/$defs/grants"
},
"+hours_to_expiration": {
"$ref": "#/$defs/hours_to_expiration"
},
Expand Down Expand Up @@ -356,6 +359,9 @@
"grant_access_to": {
"$ref": "#/$defs/grant_access_to"
},
"grants": {
"$ref": "#/$defs/grants"
},
"hours_to_expiration": {
"$ref": "#/$defs/hours_to_expiration"
},
Expand Down Expand Up @@ -442,6 +448,9 @@
"+enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"+grants": {
"$ref": "#/$defs/grants"
},
"+meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -472,6 +481,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"$ref": "#/$defs/grants"
},
"meta": {
"$ref": "#/$defs/meta"
},
Expand Down Expand Up @@ -779,6 +791,16 @@
"additionalProperties": false
}
},
"grants": {
"type": "object",
"description": "flexible grant config. accepts any string key, expects a string or list of strings value",
"patternProperties": {
".*": {
"$ref": "#/$defs/string_or_array_of_strings"
}
},
"additionalProperties": false
},
"hours_to_expiration": {
"type": "number",
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table."
Expand Down Expand Up @@ -820,9 +842,6 @@
"alias": {
"type": "string"
},
"grants": {
"type": "object"
},
"strategy": {
"type": "string"
},
Expand Down
24 changes: 20 additions & 4 deletions schemas/dbt_yml_files.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,17 @@
"required": ["v"],
"properties": {
"v": {
"type": "number"
"type": "number"
},
"config": {
"$ref": "#/$defs/model_configs"
"$ref": "#/$defs/model_configs"
},
"columns": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/$defs/include_exclude"
"$ref": "#/$defs/include_exclude"
},
{
"$ref": "#/$defs/column_properties"
Expand Down Expand Up @@ -402,6 +402,9 @@
"enabled": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"$ref": "#/$defs/grants"
},
"quote_columns": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
Expand Down Expand Up @@ -459,7 +462,7 @@
"$ref": "#/$defs/boolean_or_jinja_string"
},
"grants": {
"type": "object"
"$ref": "#/$defs/grants"
},
"persist_docs": {
"$ref": "#/$defs/persist_docs_config"
Expand Down Expand Up @@ -789,6 +792,16 @@
},
"additionalProperties": false
},
"grants": {
"type": "object",
"description": "flexible grant config. accepts any string key, expects a string or list of strings value",
"patternProperties": {
".*": {
"$ref": "#/$defs/string_or_array_of_strings"
}
},
"additionalProperties": false
},
"include_exclude": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -836,6 +849,9 @@
"additionalProperties": false
}
},
"grants": {
"$ref": "#/$defs/grants"
},
"hours_to_expiration": {
"type": "number",
"description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table."
Expand Down
2 changes: 2 additions & 0 deletions tests/1.5/invalid/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ models:
+materialized: view
+bogus_key: true
bogus_key_no_plus: "shonuff"
+grants:
no_numbers: 55

seeds:
test:
Expand Down
5 changes: 5 additions & 0 deletions tests/1.5/valid/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ models:
contracted_models:
+contract:
enforced: true
granted_models:
+grants:
privilege: role
privileges: ["select_user", "select_cruiser"]


test_bq:
+labels:
Expand Down
4 changes: 4 additions & 0 deletions tests/1.5/valid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
models:
- name: my_first_dbt_model
description: "A starter dbt model"
config:
grants:
privilege: role
privileges: ["select_user", "select_cruiser"]
columns:
- name: id
description: "The primary key for this table"
Expand Down
Loading