I’m trying to generate a surrogate key based on the business key of the table, and the name of the source system it is coming from (this is so I can eventually merge data from two different source systems, that use similar conventions for generating ids, without unintentional collisions). At the moment, I basically have something like this
with customers as
(
select *,
'My Sales System' as source_system
from {{ source('datalake', 'customers')}}
)
select {{ dbt_utils.generate_surrogate_key(['customer_id', 'source_system']) }},
*
from customers
For simplicity sake, I’d like to skip the CTE and be able to reference the name of the source system directly in the surrogate key function, eg;
select {{ dbt_utils.generate_surrogate_key(['customer_id', ''My Sales System'']) }},
*
from {{ source('datalake', 'customers')}}
But all my attempts to escape the quote marks seems to fail. How do I pass a hardcode string directly to a function like this (as opposed to a column output)?