Skip to content

Commit

Permalink
feat(bigquery): Update README with BigQuery and explanation trick to …
Browse files Browse the repository at this point in the history
…deactivate on-run-end macro by providing a variable updon running a dbt command
  • Loading branch information
charles-astrafy committed Aug 12, 2022
1 parent 628f680 commit 6b9d101
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ packages:
3. Add an on-run-end hook to your `dbt_project.yml`: `on-run-end: "{{ dbt_artifacts.upload_results(results) }}"`
(We recommend adding a conditional here so that the upload only occurs in your production environment, such as `on-run-end: "{% if target.name == 'prod' %}{{ dbt_artifacts.upload_results(results) }}{% endif %}"`)

4. Create the tables dbt_artifacts uploads to with `dbt run-operation create_dbt_artifacts_tables`
4. In case you don't want the artifacts to be uploaded for certain dbt commands (for instance 'dbt compile'), add the following conditional:
`on-run-end: "{% if not var('artifact', False) %}{{ dbt_artifacts.upload_results(results) }}{% endif %}"`
If you then run the following command by providing a variable to the command, the 'on-run-end' will not execute:
`dbt compile --vars 'artifact: disable'`

5. Run your project!

Expand All @@ -55,6 +58,7 @@ models:
+schema: your_destination_schema # optional, default is your target database
staging:
+schema: your_destination_schema # optional, default is your target schema
...
```

You can also implement your own logic by overriding the default [generate_database_name](https://docs.getdbt.com/docs/building-a-dbt-project/building-models/using-custom-databases)
Expand Down

0 comments on commit 6b9d101

Please sign in to comment.