dbt-labs / dbt-codegen

Macros that generate dbt code
https://hub.getdbt.com/dbt-labs/codegen/latest/
Apache License 2.0
464 stars 102 forks source link

generate_source on Snowflake doesn't generate any table names #89

Closed jaredx435k2d0 closed 1 year ago

jaredx435k2d0 commented 1 year ago

Describe the bug

generate_source on Snowflake doesn't generate any table names (or columns). I'm not seeing any errors anywhere. It simply doesn't finish outputting the yml.

This only happens for some schemas in my source DB. I don't see a pattern in why it happens in some but not others.

Steps to reproduce

I executed dbt run-operation generate_source --args '{"schema_name": "my_actual_schema_name", "database_name": "my_actual_database_name", "generate_columns": "True"}'

Expected results

version: 2

sources:
  - name: [my_actual_source_name]
    database: my_actual_database_name
    tables:
      - name: accounts
        description: ""
        columns:
          - name: id
            description: ""
          - name: country_id
            description: ""

      - name: products
        description: ""
        columns:
          - name: id
            description: ""
          - name: name
            description: ""
          - name: record_type
            description: ""

Actual results

version: 2

sources:
  - name: [my_actual_source_name]
    database: my_actual_database_name
    tables:

Screenshots and log output

System information

The contents of your packages.yml file:

Which database are you using dbt with?

The output of dbt --version:

dbt --version
Core:
  - installed: 1.3.0
  - latest:    1.3.0 - Up to date!

Plugins:
  - snowflake: 1.3.0 - Up to date!

The operating system you're using: macOS 12.6.1 (21G217)

The output of python --version: 3.9.15

pkanter commented 1 year ago

I had come here to support this bug note, but made a couple of changes to my generate_source verbiage and got the expected results. I made sure my schema name was the actual schema in the database, not the name of the source, and the database name was the name of the database. Once I made this change, I got the table names as well as columns, with a description placeholder.

jaredx435k2d0 commented 1 year ago

https://github.com/boblannon-fp said:

It seems to have to do with the fact that snowflake returns column names in all-caps.

Then referenced https://github.com/dbt-labs/dbt-codegen/issues/82

jaredx435k2d0 commented 1 year ago

@pkanter interesting. Thanks for the info!

FWIW, when I'm running it, I'm also using the actual database name and actual schema name.

github-actions[bot] commented 1 year ago

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

github-actions[bot] commented 1 year ago

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.