dbt-labs / dbt-labs/dbt-codegen

Bigquery Array<string> being interpreted as String when source is generated

Open
#249 1 comment 0 reactions 0 assignees View on GitHub
bug Stale triage
Dominant language
Makefile
Stars
676
Forks
132
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

The generate_source macro misinterprets the ARRAY type in Bigquery. And set column type to STRING

### Steps to reproduce

1. Create table in Bigquery with ARRAY column
`create table test_schema.test_table (x array)`
2. Run source generation in CLI
`dbt run-operation generate_source --args '{"schema_name": "test_schema", "generate_columns": true}'`

### Expected results

I expect to have correct type in source definition
```
- name: test_table
columns:
- name: x
data_type: array
```
### Actual results

```
- name: test_table
columns:
- name: x
data_type: string
```
### Screenshots and log output

### System information
**The contents of your `packages.yml` file:**
```
packages:
- package: dbt-labs/codegen
version: 0.13.1
- package: dbt-labs/dbt_utils
version: 1.3.0
- package: elementary-data/elementary
version: 0.16.3
- package: calogica/dbt_expectations
version: 0.10.4
- package: calogica/dbt_date
version: 0.10.1
```

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

**The output of `dbt --version`:**
```
Core:
- installed: 1.8.3
- latest: 1.9.2

Plugins:
- bigquery: 1.8.2
```

**The operating system you're using:**
Apple M1

**The output of `python --version`:**
Python 3.11.8

### Additional context

### Are you interested in contributing the fix?

It is possible

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.