diff --git a/README.md b/README.md index fa3f6ef0..3e0ccc30 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,17 @@ Note that model materializations and `on_schema_change` configs are defined in t > Configurations made in your dbt_project.yml file will override any configurations in a package (either in the dbt_project.yml file of the package, or in config blocks). +### Selection of packages to upload + +By default, all packages are uploaded. Some users may be interested in choosing which packages to upload from non-execution datasets. Thus, we allow setting `artifacts_upload_packages` variable: + +```yml +vars: + artifacts_upload_packages: ['my_package'] +``` + +> Note: execution-type artifacts are not affected by this filter. + ### Environment Variables If the project is running in dbt Cloud, the following five columns () will be automatically populated in the fct_dbt__invocations model: diff --git a/macros/upload_results/get_dataset_content.sql b/macros/upload_results/get_dataset_content.sql index b34e39cd..c08c24cf 100644 --- a/macros/upload_results/get_dataset_content.sql +++ b/macros/upload_results/get_dataset_content.sql @@ -6,6 +6,10 @@ {% elif dataset in ['seeds', 'snapshots', 'tests', 'models'] %} {# Use the nodes in the [graph](https://docs.getdbt.com/reference/dbt-jinja-functions/graph) to extract details #} {% set objects = graph.nodes.values() | selectattr("resource_type", "equalto", dataset[:-1]) | list %} + {# Optionally, filter by package_name #} + {% if var("artifacts_upload_packages", "all") != "all" %} + {% set objects = (objects | selectattr("package_name", "in", var("artifacts_upload_packages")) | list) %} + {% endif %} {% elif dataset in ['exposures', 'sources'] %} {# Use the [graph](https://docs.getdbt.com/reference/dbt-jinja-functions/graph) to extract details #} {% set objects = graph.get(dataset).values() | list %}