-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is this your first time submitting a feature request?
- I have read the expectations for open source contributors
- I have searched the existing issues, and I could not find an existing issue for this feature
- I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
Describe the feature
As far as I know, there are no macros to get information about disabled models. If we can take advantage of get information about disabled resources even in Jinja2 macros, that would be helpful.
For instance, I would like to implement a custom macro to drop tables which were created by dbt but are no longer used.
We don't manage the entire lifecycle of relations with dbt, because dbt 1.3 or later doesn't manage non-maintained models. We have to manually drop tables/views of disabled models.
Expected behavior
If information about disabled models with the graph macro, we can implement the desired feature to drop them as the code block below.
{% macro %}
{% set disabled_models = graph.disabled.values() | selectattr("resource_type", "equals", "model") %}
{% for disable_model in disabled_models %}
{# implementation to drop a relation #}
{% endfor %}
{% endmacro %}
Describe alternatives you've considered
As the manifest artifact contains the disabled object, we can alternatively implement desired features with a manifest JSON file. But, we can't refer the artifacts in macros.
Besides, there is a discussion to automatically maintain schemas. The feature partially satisfies what I want to do as dropping tables/views of not-maintained models.
Who will this benefit?
The feature would be useful to take advantage of disabled resources in macros.
For example. according to my research, brooklyn-data/dbt_artifacts enables us to persist information from the graph macro into a warehouse. I am guessing there are some dbt users to persist metadata of disabled resources as well. If disable resources get accessible with macros, we can persist them.
Are you interested in contributing this feature?
I would love to contribute this feature.
Anything else?
No response