How to get unique key value using macro call in incremental config

Hello Everyone,

The problem I’m having is passing bunch of unique keys to perform a merge in unique_key config variable inside dbt core . If i pass them inside list like [‘A’, ‘B’ ] it works okay. I can do config.get(‘unique_key’) and display the value perfectly fine.

However,

If i pass the config like the unique key is returning a value of False.

{{
materialisation = ‘incremental’,
unique_key=my_unique_key_macro(‘tablename’)

}}

How i am getting unique keys : by running a sql query on snowflake via dbt macro and converting the string into Array using inbuilt snowflake Array functions.

Return value of macro is just the {{ array_unique_keys }}

I am not really sure why it is failing and returns false , it could be that the value is still string but i dont know how to check it , is there a way to return a data type of a return value if the variable ?

Can someone help me dynamically passing the unique keys list using a macro call on snowflake table ?

Thanks alot.

Hello Everyone ,
Does anyone know answer for this problem ? I’m having the same issue macro returning FALSE when I fetch the unique key form macro .

Hello there,

Could you please show the definition of the my_unique_key_macro macro?