dbt-codegen icon indicating copy to clipboard operation
dbt-codegen copied to clipboard

get_models seems broken in 1.8

Open sdebruyn opened this issue 1 year ago • 2 comments

Steps to reproduce

  1. Install dbt-core 1.8.0b2 with a compatible adapter
  2. Create a new analysis and paste {{ log('repro: ' ~ codegen.get_models(directory='somedir')) }}
  3. Run dbt run -s your_analysis

Expected results

A log with your models

Actual results

Compilation error 'dict object' has no attribute 'nodes'

System information

packages:
  - package: dbt-labs/codegen
    version: 0.12.1

Which database are you using dbt with?

  • [x] postgres
  • [ ] redshift
  • [ ] bigquery
  • [ ] snowflake
  • [ ] other (specify: ____________)

The output of dbt --version:

Core:
  - installed: 1.8.0-b2
  - latest:    1.7.11   - Ahead of latest version!

Plugins:
  - postgres:    1.8.0b1 - Ahead of latest version!
  - timescaledb: 1.8.0b2 - Up to date!

The operating system you're using: macOS

The output of python --version: Python 3.11.8

sdebruyn avatar Apr 05 '24 21:04 sdebruyn

thanks @sdebruyn -- we're getting ready to cut a new release next week so we'll dig into this and make sure it gets fixed before we do that! thanks for the heads up!

gwenwindflower avatar Apr 05 '24 21:04 gwenwindflower

hey @sdebruyn were you wrapping that in an if execute tag? wondering if it's just this -- there aren't nodes in the graph in the parsing stage that would typically apply to an analysis file.

gwenwindflower avatar Apr 08 '24 19:04 gwenwindflower

Could the example in the readme (https://github.com/dbt-labs/dbt-codegen?tab=readme-ov-file#generate_model_yaml-source) that uses codegen.get_models be updated to include 'if execute'? As the documentation is written now, it results in the error described in this issue.

mrhorvath avatar Oct 04 '24 12:10 mrhorvath