calogica / dbt-expectations

Port(ish) of Great Expectations to dbt test macros
https://calogica.github.io/dbt-expectations/
Apache License 2.0
1.01k stars 123 forks source link

ms sql server support: dbt_expectations.expect_column_value_lengths_to_equal #227

Closed welsh-wonder closed 1 year ago

welsh-wonder commented 1 year ago

I have the package loaded into my dbt project, and have added the following assertion/test to my sources.yml file using dbt-expectations 0.8.0:

- dbt_expectations.expect_column_value_lengths_to_equal:
                  value: 10

When I perform a dbt run, it tries to execute the following SQL on a configured Microsoft SQL server instance:

with grouped_expression as (
select
           len( patient_number) = 10 as expression
from "databasename"."dbo"."patient"
),
validation_errors as (
select
        *
from grouped_expression
where not(expression = true)
)
select *
from validation_errors

However, this inevitably errors. Is there support for dbt projects with configured ms sql server connections?

clausherther commented 1 year ago

Hi, you'll need to also include the tsql-utils package, which provides shims for SQL Server for dbt-expectations, dbt-date and dbt-utils. We don't directly support SQL Server. Hope that helps!