dbt-msft / dbt-sqlserver

dbt adapter for SQL Server and Azure SQL
MIT License
212 stars 99 forks source link

Project fails in 1.7.2 using model groups #501

Closed hogank3 closed 5 months ago

hogank3 commented 5 months ago

Dbt project is failing to build after upgrading to 1.7.2. I have models grouped at the project level. For example, here in my dbt_project.yml file.

# In this example config, we tell dbt to build all models in the example/ directory
# as tables. These settings can be overridden in the individual model files
# using the `{{ config(...) }}` macro.
models:
  my_dbt_project:
    # Config indicated by + and applies to all files under models/example/
    EHR:
      +materialized: table
      +schema: EHR
      +group: EHR

This throws an error when building the project.

23:09:34  Running with dbt=1.7.14
23:09:35  Registered adapter: sqlserver=1.7.4
23:09:35  Unable to do partial parsing because a project config has changed
23:09:38  Encountered an error:
Parsing Error in model Account (models\EHR\Account.sql)
  Invalid group 'EHR', expected one of []

It will build if I remove all groups. I also tried grouping at the model level but it produces the same error. I believe it is all valid dbt syntax going off the docs. I did not have any issues with this before upgrading.\

hernanparra commented 5 months ago

Invalid group 'EHR', expected one of [] It seems there is a problem in your configuration. Is the EHR group defined in a YAML file like in the first part of this link? https://docs.getdbt.com/docs/build/groups I don't think it's a driver-related problem.

hogank3 commented 5 months ago

You are absolutely right. I was reading the docs wrong. Defining the group in my schema.yml for EHR resolved the issue. Strange I didn't need that before. Thank you!