Skip to content

Deduplication macro introduced compilation error #736

Description

@GregCWright

It seems an compilation error has been introduced since dbt-sqlserver 1.9.0 causing errors at runtime:

with source as (
    select *
    from {{ source('example', 'example') }}
)

, generated_primary_key as (
    select
        {{ dbt_utils.generate_surrogate_key(["id", "date"]) }} primary_key
        , *
    from source
)

, destination as (
    {{ dbt_utils.deduplicate(
            relation='generated_primary_key',
            partition_by='primary_key',
            order_by='last_updated desc'
        )
    }}
)

select * from destination

Causing the following error at runtime:

13:47:26  Failure in model exampl (models/staging/example.sql)
13:47:26    ('42000', "[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near 'natural'. (102) (SQLMoreResults)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions