dbt-msft / dbt-sqlserver

dbt adapter for SQL Server and Azure SQL
MIT License
216 stars 101 forks source link

Materialized Table do not Contain Columnstore Index #545

Closed zcecc22 closed 2 months ago

zcecc22 commented 2 months ago

Materialized tables created with latest stable do not get any columnstore index.

Using as_columnstore: True does not solve the issue either.

Running SQL Server 2022 Developer.

Thanks for your support, Vincent

image

Model:

SELECT CAST(MATERIAL AS int) AS [Material], CAST(PLANT AS varchar(40)) AS [Plant], CAST(STOR_LOC AS varchar(40)) AS [Storage Location], CAST(DEL_FLAG AS varchar(40)) AS [Deletion Flag], CAST(STRGE_BIN AS varchar(40)) AS [Storage Bin], TRYCAST(REPLACE([-BIC_-ZLABST], ',', '') AS float) AS [Unrestricted Stock], TRYCAST(REPLACE([-BIC_-ZINSME], ',', '') AS float) AS [Quality Inspection Stock], TRYCAST(REPLACE([-BIC_-ZBLCKSTK], ',', '') AS float) AS [Blocked Stock], TRYCAST(REPLACE([-BIC_-ZKLABS], ',', '') AS float) AS [Consignment Unrestricted Stock], TRYCAST(REPLACE([-BIC_-ZKINSM], ',', '') AS float) AS [Consignment Quality Inspection Stock], TRYCAST(REPLACE([-BIC_-ZKSPEM], ',', '') AS float) AS [Consignment Blocked Stock] FROM {{ source('sources', 'bw_mard') }}

dbt_project.yml:

models: sp_dbt_sqlserver:

Config indicated by + and applies to all files under models/example/

staging:
  +materialized: table
  +schema: staging

packages.yml:

packages:

zcecc22 commented 2 months ago

Double checked again with a clean environment and same issue. The tables created have no columnstore.

cody-scott commented 2 months ago

Can you run dbt debug and confirm the version.

zcecc22 commented 2 months ago

It was a package version issue. My pyproject.toml referenced dbt-sqlserver-dyvenia as dependency which pointed to version 1.7.3... Not sure if I should be concerned after using this package.

With dbt-sqlserver 1.8.0 no issue

cody-scott commented 2 months ago

Not sure what the dbt-sqlserver-dyvenia package is, but the one we publish is just dbt-sqlserver.

https://docs.getdbt.com/docs/core/connect-data-platform/mssql-setup

I would opt for ours linked above, if it was me.