Occasionally, our tables need to append multiple columns together to make a unique key. This can be done by doing something like:
select
*,
col1 || "_" || col2 as unique_key
from
my_table
This works but lends to a lack of uniformity amongst multiple analysts.
I would like to utilize pythons *args (i think jinja2 uses varargs) feature to make a macro that can take an arbitrary amount of arguments and create a unique key between all of them.
Ideal outcome:
select
*,
unique_key(col1, col1, ..., colN)
from
my_table