-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix: convert column type to str during dual read/write #19701
Conversation
This is great @hughhhh. Can you write a quick unit test for it? |
Codecov Report
@@ Coverage Diff @@
## master #19701 +/- ##
==========================================
- Coverage 66.51% 66.51% -0.01%
==========================================
Files 1684 1684
Lines 64559 64584 +25
Branches 6626 6626
==========================================
+ Hits 42941 42955 +14
- Misses 19923 19934 +11
Partials 1695 1695
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Should we save the original database type here? The type field specifically used Text as storage so the originally intention is probably to allow storing the full schema of complex types such as ARRAY and STRUCT? What does the old column model save? |
I'm pretty sure it was still ARRAY, but this is only a patch i'm pretty sure there other types we'd have to map to strings later |
bb732bc
to
f7c1bb7
Compare
if column_type.python_type == list: | ||
return "ARRAY" | ||
if column_type.python_type == dict: | ||
return "JSON" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it also be a STRUCT
? I guess it probably depends on the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so i'm following the pattern from the sqlalchemy.sql.sqltypes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we save the original database type here? The type field specifically used Text as storage so the originally intention is probably to allow storing the full schema of complex types such as ARRAY and STRUCT?
I agree, using the original native type is the ideal solution here.
f7c1bb7
to
8269591
Compare
🏷️ preset:2022.15 |
SUMMARY
Users are blocked when trying to save a dataset on a query/table that has an ARRAY column in it. Due the python_type returning a list instead of a str for the type. To fix this i've added a util function to check if the type is a list and convert it to a string like this
ARRAY
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION