The problem I’m having
I’m encountering an issue with retrieving values using a macro within a config block. Here’s the code snippet:
{% set category = get_cluster_key(‘CATEGORY’) %}
{{ config(materialized=“table”, schema=“schema”, cluster_by=[‘start’~category~‘_end’, ‘col2’]) }}
However, I’m not getting the expected value.
The context of why I’m trying to do this
I need to dynamically retrieve a value from a table that undergoes changes.
What I’ve already tried
I attempted to address this by implementing an execution block within the macro file and returning a dummy value when the macro isn’t executed. I followed the guidance provided : About execute variable | dbt Developer Hub (getdbt.com)
I understand that I’m getting an empty value when dbt isn’t in execution mode, but I’m unsure how to make it read the value within the execution block.