-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'current' into runleonarun-patch-10
- Loading branch information
Showing
11 changed files
with
119 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
resource_types: [models] | ||
datatype: access | ||
--- | ||
|
||
<File name='models/<schema>.yml'> | ||
|
||
```yml | ||
version: 2 | ||
|
||
models: | ||
- name: model_name | ||
access: private | protected | public | ||
``` | ||
</File> | ||
<VersionBlock lastVersion="1.6"> | ||
Access modifiers may be applied to models one-by-one in YAML properties. In v1.5 and v1.6, you are unable to configure `access` for multiple models at once. Upgrade to v1.7 for additional configuration options. A group or subfolder contains models with varying access levels, so when you designate a model with `access: public`, make sure you intend for this behavior. | ||
|
||
</VersionBlock> | ||
|
||
<VersionBlock firstVersion="1.7"> | ||
|
||
You can apply access modifiers in config files, including `the dbt_project.yml`, or to models one-by-one in YAML properties. Applying access configs to a subfolder modifies the default for all models in that subfolder, so make sure you intend for this behavior. When setting individual model access, a group or subfolder might contain a variety of access levels, so when you designate a model with `access: public` make sure you intend for this behavior. | ||
|
||
There are multiple approaches to configuring access: | ||
|
||
In the model configs of `dbt_project.yml``: | ||
|
||
```yaml | ||
models: | ||
- name: my_public_model | ||
access: public # Older method, still supported | ||
``` | ||
Or (but not both) | ||
|
||
```yaml | ||
models: | ||
- name: my_public_model | ||
config: | ||
access: public # newly supported in v1.7 | ||
``` | ||
|
||
In a subfolder: | ||
```yaml | ||
models: | ||
my_project_name: | ||
subfolder_name: | ||
+group: <my_group> | ||
+access: private # sets default for all models in this subfolder | ||
``` | ||
|
||
In the model.sql file: | ||
|
||
```sql | ||
-- models/my_public_model.sql | ||
{{ config(access = "public") }} | ||
select ... | ||
``` | ||
|
||
</VersionBlock> | ||
|
||
## Definition | ||
The access level of the model you are declaring properties for. | ||
|
||
Some models (not all) are designed to be referenced through the [ref](/reference/dbt-jinja-functions/ref) function across [groups](/docs/build/groups). | ||
|
||
| Access | Referenceable by | | ||
|-----------|-------------------------------| | ||
| private | same group | | ||
| protected | same project/package | | ||
| public | any group, package or project | | ||
|
||
If you try to reference a model outside of its supported access, you will see an error: | ||
|
||
```shell | ||
dbt run -s marketing_model | ||
... | ||
dbt.exceptions.DbtReferenceError: Parsing Error | ||
Node model.jaffle_shop.marketing_model attempted to reference node model.jaffle_shop.finance_model, | ||
which is not allowed because the referenced node is private to the finance group. | ||
``` | ||
|
||
## Default | ||
|
||
By default, all models are "protected." This means that other models in the same project can reference them. | ||
|
||
## Related docs | ||
|
||
* [Model Access](/docs/collaborate/govern/model-access#groups) | ||
* [Group configuration](/reference/resource-configs/group) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters