Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to use meta field of a resource #13

Merged
merged 3 commits into from
May 26, 2023

Conversation

pratik60
Copy link
Contributor

From: https://docs.getdbt.com/reference/resource-configs/meta

The meta field can store custom information about a model which would be useful metadata to add to query tags to filter data. My usecase is to filter query by team owner and associate cost accordingly.

I verified this with "meta" being empty for a model, which would generate an empty {}. If meta is populated, it would use that in the query tag.

@pratik60 pratik60 had a problem deploying to Approve Integration Tests May 25, 2023 21:09 — with GitHub Actions Failure
@pratik60 pratik60 had a problem deploying to Approve Integration Tests May 25, 2023 21:13 — with GitHub Actions Failure
@pratik60 pratik60 temporarily deployed to Approve Integration Tests May 25, 2023 21:16 — with GitHub Actions Inactive
@NiallRees
Copy link
Member

Looks great - confirmed to be working as expected:

create or replace transient table DBT_CI.dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7.materialized_table
         as
        (

select 1 as a
        )
/* {"app": "dbt", "dbt_snowflake_query_tags_version": "2.0.1", "dbt_version": "1.5.0", "project_name": "dbt_snowflake_query_tags_tests", "target_name": "snowflake", "target_database": "DBT_CI", "target_schema": "dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7", "invocation_id": "a935a98f-cd45-45f7-8a7a-444661eb3e38", "node_name": "materialized_table", "node_alias": "materialized_table", "node_package_name": "dbt_snowflake_query_tags_tests", "node_original_file_path": "models/materialized_table.sql", "node_database": "DBT_CI", "node_schema": "dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7", "node_id": "model.dbt_snowflake_query_tags_tests.materialized_table", "node_resource_type": "model", "node_meta": {"model_maturity": "in dev", "owner": "@alice"}, "node_tags": ["a"], "node_refs": [], "materialized": "table"} */;
insert into DBT_CI.dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7.materialized_incremental ("A")
        (
            select "A"
            from DBT_CI.dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7.materialized_incremental__dbt_tmp
        )
/* {"app": "dbt", "dbt_snowflake_query_tags_version": "2.0.1", "dbt_version": "1.5.0", "project_name": "dbt_snowflake_query_tags_tests", "target_name": "snowflake", "target_database": "DBT_CI", "target_schema": "dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7", "invocation_id": "a935a98f-cd45-45f7-8a7a-444661eb3e38", "node_name": "materialized_incremental", "node_alias": "materialized_incremental", "node_package_name": "dbt_snowflake_query_tags_tests", "node_original_file_path": "models/materialized_incremental.sql", "node_database": "DBT_CI", "node_schema": "dbt_snowflake_query_tags_test_commit_ae358756718460aa1452f1833e22a17baa6836a7", "node_id": "model.dbt_snowflake_query_tags_tests.materialized_incremental", "node_resource_type": "model", "node_meta": {}, "node_tags": ["a", "b", "c"], "node_refs": ["materialized_table", "materialized_view"], "materialized": "incremental"} */;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants