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: anyOf sql types not parsed properly #1774

Closed
pnadolny13 opened this issue Jun 19, 2023 · 0 comments · Fixed by #1775
Closed

bug: anyOf sql types not parsed properly #1774

pnadolny13 opened this issue Jun 19, 2023 · 0 comments · Fixed by #1775

Comments

@pnadolny13
Copy link
Contributor

This json type is returning a VARCHAR sql type when it should be returning a DATETIME:

{"anyOf": [{"type": "string", "format": "date-time"}, {"type": "null"}]}

It looks like the bug is in the fact that to_sql_type is calling _jsonschema_type_check to check if its considered a string and its returning false because the anyof logic is looking for the {"type": "string", "format": "date-time"} in ("string",) when really it should be calling itself again for each anyof item.

pnadolny13 added a commit to MeltanoLabs/target-snowflake that referenced this issue Jun 20, 2023
Closes #62

Test added before fix, failures in
https://github.com/MeltanoLabs/target-snowflake/actions/runs/5316144247/jobs/9625351211?pr=63.

- adds a tests to alter from ~timestamp to string and~ string to
integer. UPDATE: turns out snowflake doesnt allow timestamp to string
like I expected so it only alters string to int.
- overrides _jsonschema_type_check method to fix bug from
meltano/sdk#1774
- overrides `get_table_columns` to cast custom types from sqlalchemy
inspect to our custom types with `python_type` implemented

---------

Co-authored-by: Ken Payne <[email protected]>
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 a pull request may close this issue.

1 participant