Skip to content

Does not escape columns matching keywords #261

@deenairn

Description

@deenairn

Describe the bug

When generating base models with table columns that are keywords, it does not escape them to the correct casing for the underlying source.

Steps to reproduce

Had a snowflake source table with a column name "ORDER". When generating the base models using codegen.create_base_models it did not escape the column, resulting in the generated output failing. In addition, as the column name was all uppercase, it was necessary to change the casing.

Expected results

If the underlying column was ORDER the name should be escape and match this case, i.e. not order, it should be "ORDER".

Actual results

Generates order.

Screenshots and log output

System information

**The contents of your packages.yml file:
packages:

  • package: metaplane/dbt_expectations
    version: [">=0.10.9", "<0.11.0"]
  • package: dbt-labs/dbt_utils
    version: 1.3.1
  • package: dbt-labs/codegen
    version: 0.13.1

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

Core:
  - installed: 1.9.0

The operating system you're using: Linux

**The output of python --version: Python 3.11.2

Additional context

Are you interested in contributing the fix?

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