Skip to content

[Bug] dbt compile fails when models include model.batch #11843

@ross-whatnot

Description

@ross-whatnot

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

We have a model that contains references to model.batch, along the lines of:

col >= '{{ model.batch.event_time_start }}'::timestamp_ntz and col < '{{ model.batch.event_time_end }}'::timestamp_ntz + interval '7 day'`)

When we run dbt compile (as a part of CI), we get an error like:

Runtime Error
  Compilation Error in model abc (models/abc.sql)
    'dict object' has no attribute 'batch'. This can happen when calling a macro that does not exist. Check for typos and/or install package dependencies with "dbt deps".

No errors arise when actually running the model (with dbt run or dbt build), only during standalone compile.

Expected Behavior

dbt compile should not fail.

Steps To Reproduce

  1. Create a model that includes a reference to model.batch
  2. run dbt compile

Relevant log output

Environment

Core:
  - installed: 1.9.1 
  - latest:    1.10.4 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - snowflake: 1.9.1 - Update available!

  At least one plugin is out of date with dbt-core.
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions