-
Notifications
You must be signed in to change notification settings - Fork 977
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 patkearns10-redshift-client-alive-parameters
- Loading branch information
Showing
120 changed files
with
339 additions
and
1,074 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 |
---|---|---|
|
@@ -68,127 +68,6 @@ You can use hooks to provide database-specific functionality not available out-o | |
</File> | ||
|
||
|
||
</VersionBlock> | ||
|
||
<VersionBlock lastVersion="1.1"> | ||
|
||
### Examples using hooks | ||
|
||
Here's a minimal example of using hooks to grant privileges. For more information, see [`on-run-start` & `on-run-end` hooks](/reference/project-configs/on-run-start-on-run-end) and [`pre-hook` & `post-hook`](/reference/resource-configs/pre-hook-post-hook) reference sections. | ||
|
||
<File name='dbt_project.yml'> | ||
|
||
```yml | ||
on-run-end: | ||
- "grant usage on {{ target.schema }} to role reporter" | ||
|
||
models: | ||
+post-hook: | ||
- "grant select on {{ this }} to role reporter" | ||
|
||
``` | ||
|
||
</File> | ||
|
||
You can also apply the `post-hook` to individual models using a `config` block: | ||
|
||
<File name='models/<model_name>.sql'> | ||
|
||
```sql | ||
{{ config( | ||
post_hook=[ | ||
"grant select on {{ this }} to role reporter" | ||
] | ||
) }} | ||
|
||
select ... | ||
|
||
``` | ||
|
||
</File> | ||
|
||
You should use database-specific syntax when appropriate: | ||
|
||
<WHCode> | ||
|
||
<div warehouse="BigQuery"> | ||
|
||
<File name='models/<model_name>.sql'> | ||
|
||
```sql | ||
{{ config( | ||
post_hook=[ | ||
'grant `roles/bigquery.dataViewer` on {{ this.type }} {{ this }} to "user:[email protected]"' | ||
] | ||
) }} | ||
|
||
select ... | ||
|
||
``` | ||
|
||
</File> | ||
|
||
</div> | ||
|
||
<div warehouse="Databricks"> | ||
|
||
<File name='models/<model_name>.sql'> | ||
|
||
```sql | ||
{{ config( | ||
post_hook=[ | ||
"grant select on {{ this }} to `[email protected]`" | ||
] | ||
) }} | ||
|
||
select ... | ||
|
||
``` | ||
|
||
</File> | ||
|
||
</div> | ||
|
||
<div warehouse="Redshift"> | ||
|
||
<File name='models/<model_name>.sql'> | ||
|
||
```sql | ||
{{ config( | ||
post_hook=[ | ||
"grant select on {{ this }} to reporter" | ||
] | ||
) }} | ||
|
||
select ... | ||
|
||
``` | ||
|
||
</File> | ||
|
||
</div> | ||
|
||
<div warehouse="Snowflake"> | ||
|
||
<File name='models/<model_name>.sql'> | ||
|
||
```sql | ||
{{ config( | ||
post_hook=[ | ||
"grant select on {{ this }} to role reporter" | ||
] | ||
) }} | ||
|
||
select ... | ||
|
||
``` | ||
|
||
</File> | ||
|
||
</div> | ||
|
||
</WHCode> | ||
|
||
</VersionBlock> | ||
|
||
### Calling a macro in a hook | ||
|
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
Oops, something went wrong.