dbt-labs / dbt-labs/dbt-codegen

Do not convert model and column names to lowercase by default

Open
#263 0 comments 2 reactions 0 assignees View on GitHub
bug triage
Dominant language
Makefile
Stars
676
Forks
132
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug
Converting model and column names to lowercase by default generates incorrect **name** for models/columns with any uppercase character. It leads to

`08:29:26 [WARNING]: Did not find matching node for patch with name 'model_name_with_uppercase_character' in the 'models' section of file 'models/raw/_schema.yml'`

### Steps to reproduce
Create model with name:
Model_name_with_uppercase_character

and its content

select cast(1 as int64) as UPPERCASE_COL

### Expected results
```
version: 2
models:
- name: Model_name_with_uppercase_character
description: ""
columns:
- name: UPPERCASE_COL
data_type: int64
description: ""
```

### Actual results
```
version: 2
models:
- name: model_name_with_uppercase_character
description: ""
columns:
- name: uppercase_col
data_type: int64
description: ""
```

### Screenshots and log output

### System information
**The contents of your `packages.yml` file:**
packages:
```
- package: dbt-labs/dbt_utils
version: 1.3.0
- package: dbt-labs/audit_helper
version: 0.12.1
- package: elementary-data/elementary
version: 0.19.4
- package: dbt-labs/dbt_external_tables
version: 0.11.1
- package: dbt-labs/codegen
version: 0.13.1
```

**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [x] bigquery
- [ ] snowflake
- [ ] other (specify: ____________)

**The output of `dbt --version`:**
```
Core:
- installed: 1.10.11
- latest: 1.10.15 - 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:
- bigquery: 1.10.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
```

**The operating system you're using:**
MacOS
**The output of `python --version`:**
Python 3.12.11
### Additional context
Caused by
**models**
[lower for models](https://github.com/dbt-labs/dbt-codegen/blob/474f7a10582b74b03fa9c065847b6f0463d24c23/macros/generate_model_yaml.sql#L43)

**colums**
[lower for columns](https://github.com/dbt-labs/dbt-codegen/blob/474f7a10582b74b03fa9c065847b6f0463d24c23/macros/generate_model_yaml.sql#L12)

### Are you interested in contributing the fix?
No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.