global variable

The problem I’m having

was trying , having some issue
Compilation Error in model stg_tpch_line_items (models/staging/tpch/stg_tpch_line_items.sql)

Warning: dbt_utils.surrogate_key has been replaced by dbt_utils.generate_surrogate_key. The new macro treats null values differently to empty strings. To restore the behaviour of the original macro, add a global variable in dbt_project.yml called surrogate_key_treat_nulls_as_empty_strings to your dbt_project.yml file with a value of True. The snowflake_workshop.stg_tpch_line_items model triggered this warning.

I have tried , added the dbt_utils.surrogate_key in dbt_project.yml , still having the same issue ! any suggestions >

Have you tried dbt_utils.surrogate_key or dbt_utils.generate.surrogate_key ?

Brother, bruno…thx
yes, I have tried both dbt_utils.surrogate_key or dbt_utils.generate.surrogate_key , but still having the same issue ! do you suspect any issues with versions …(I’m new to dbt)…if you think so! guide , thanks

Could you paste your model here? And the versions of dbt and dbt_utils you are using?

version 0.37.12 of the dbt Cloud CLI is now available. As of now, old versions are not actively supported - update now!
dbt Cloud CLI - 0.37.11 (9221855f5b35004b4bc53ba2c9df9baf02fb9331 2024-04-26T15:56:01Z)

–dbt_utils: version: 0.8.4

here is the model…

with source as (

    select * from {{ source('tpch', 'lineitem') }}

),

renamed as (

    select
    
        {{ dbt_utils.surrogate_key(
            ['l_orderkey', 
            'l_linenumber']) }}
                as order_item_key,
        l_orderkey as order_key,
        l_partkey as part_key,
        l_suppkey as supplier_key,
        l_linenumber as line_number,
        l_quantity as quantity,
        l_extendedprice as extended_price,
        l_discount as discount_percentage,
        l_tax as tax_rate,
        l_returnflag as return_flag,
        l_linestatus as status_code,
        l_shipdate as ship_date,
        l_commitdate as commit_date,
        l_receiptdate as receipt_date,
        l_shipinstruct as ship_instructions,
        l_shipmode as ship_mode,
        l_comment as comment

    from source

)

select * from renamed

Ok, you are using dbt Cloud. Yeah this could be a version issue.

Check the dbt version in your environment in dbt Cloud, you are probably using a version >=1.3.

You will probably need to update your dbt utils to at least v1.0.0, where the new surrogate key macro was implemented.

Hi Bro,
yes, utils version is updated to 1.0.0, the problem is resolved…thanks a lot …