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] Column.from_description crashes on structured type columns #262

Open
2 tasks done
jelmerk opened this issue Jul 12, 2024 · 1 comment
Open
2 tasks done

[Bug] Column.from_description crashes on structured type columns #262

jelmerk opened this issue Jul 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jelmerk
Copy link

jelmerk commented Jul 12, 2024

Is this a new bug?

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

Current Behavior

Invoking Column.from_description for a column that is a structured type fails

Expected Behavior

It should return a Column

Steps To Reproduce

from dbt.adapters.base.column import Column
Column.from_description("AUTO_JOINED_ACCOUNTS", "ARRAY(NUMBER(19,0))")

Relevant log output

dbt_common.exceptions.base.DbtRuntimeError: Runtime Error
  Could not interpret data_type "ARRAY(NUMBER(19,0))": could not convert "NUMBER(19" to an integer

Environment

- OS: MacOs
- Python: 3.10.13
- dbt-adapters: dbt-snowflake 1.8.3

Additional Context

This is a big problem because methods like dbt_utils.get_filtered_columns_in_relation and adapter.get_columns_in_relation use this method and now cannot be used with tables with structured types

@jelmerk jelmerk added bug Something isn't working triage labels Jul 12, 2024
@jelmerk jelmerk changed the title [Bug] Column.from_description crashes on structured typesd [Bug] Column.from_description crashes on structured types Jul 12, 2024
@jelmerk jelmerk changed the title [Bug] Column.from_description crashes on structured types [Bug] Column.from_description crashes on structured type columns Jul 12, 2024
@colin-rogers-dbt
Copy link
Contributor

Likely an issue with the regex:

match = re.match(r"([^(]+)(\([^)]+\))?", raw_data_type)

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

No branches or pull requests

3 participants