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

Better handle nested Array types #311

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

jdistler
Copy link

resolves #310

Problem

When a model uses get_columns_in_relation on a table which includes columns of complex array types like ARRAY(VARCHAR(16777216)), we raise an error because the pre-existing logic only expects there to be an int inside the parentheses. In this case we have nested types so VARCHAR(16777216) cannot be converted to an int and processing fails.

Solution

Before we try to convert to an int, we run some new regex to check if this is a nested type, as in some alphabet chars followed by an open parentheses. If so, we do not try to extract a char_size, numeric_precision, or numeric_scale and instead allow the code to return with those variables left as None.

In the case of VARCHAR(16777216), we would have data_type = ARRAY, char_size = None, numeric_precision = None, numeric_scale = None.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development, and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX

Copy link

cla-bot bot commented Sep 18, 2024

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @jdistler

Copy link

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Support complex Array data types for macro get_columns_in_relation
1 participant