Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] New RANGE type in bigquery failing when setting descriptions #1341

Open
2 tasks done
borjavb opened this issue Sep 11, 2024 · 1 comment
Open
2 tasks done

[Bug] New RANGE type in bigquery failing when setting descriptions #1341

borjavb opened this issue Sep 11, 2024 · 1 comment
Labels
awaiting_response bug Something isn't working

Comments

@borjavb
Copy link

borjavb commented Sep 11, 2024

Is this a new bug in dbt-bigquery?

  • I believe this is a new bug in dbt-bigquery
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When using the new RANGE type, in a model, the model will be created correctly, but dbt will fail while trying to update the descriptions of the schema:
400 PATCH <> Range field <field> must have a range element type.

The new SchemaField for RANGE data types expects an extra parameter range_element_type with values {date,datetime,timestamp} in order to work https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.schema.SchemaField

Expected Behavior

dbt runs correctly and applies the column descriptions without erroring

Steps To Reproduce

Create a model with its respective yaml file description, and run it

table_a.sql

SELECT RANGE(DATE '2021-01-01', DATE '2023-01-01') column_range

table_a.yaml

models:
  - name: table_a
    description: something
    columns:
      - name: column_range
        description: placeholder

Relevant log output

400 PATCH <> Range field column_range must have a range element type.

Environment

- OS: Mac Os m1
- Python: 3.9
- dbt-core: 1.8
- dbt-bigquery: v1.8.2

Additional Context

No response

@borjavb borjavb added bug Something isn't working triage labels Sep 11, 2024
@borjavb borjavb changed the title [Bug] New RANGE type in bigquery not working when setting descriptions [Bug] New RANGE type in bigquery failing when setting descriptions Sep 11, 2024
@anaghshineh
Copy link

Hey, @borjavb. I was interested in this and took a quick look. Seems to work for me based on some cursory playing around. Are you able to confirm what version of google-cloud-bigquery is running under the hood?

A few observations:

  • Looks like the SchemaField class now requires range_element_type for fields with type RANGE in later versions (as you mentioned)
  • Support for range_element_type was added in version 3.15.0, but it's not present in the prior 3.14.1 version
  • I tested this adapter's logic here with a pre-existing table containing a field of type RANGE to try to update the description
    • When I explicitly had google-cloud-bigquery==3.15.0, it worked just fine
    • When I explicitly downgraded to google-cloud-bigquery==3.14.1, I hit the same error you mentioned in this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting_response bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants