-
Notifications
You must be signed in to change notification settings - Fork 13.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(sql_lab): Add custom timestamp type for literal casting for presto timestamps #13082
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d0d9424
Add custom timestamp type for literal casting for presto timestamps
30dc769
Remove typo in comment
72237b3
Use process_bind_params as in sqla docs
8b41dba
Uncommit local superset config
593b821
Add DATE literal casting
91fc846
Fix lint errors and change var name
626a723
Get rid of col_type and whitespace
a7f0940
Fix linting
c206354
Fix arg type
2feb219
Fix isort lint error
862478e
ran black and isort locally..
7d1e104
accidentally removed EOF
6c69f95
Dont need eof
1a0614f
Use newer string formatting style from comments
kekwan 5dee4c7
Trigger notification
john-bodley a06038b
Trigger notification
john-bodley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm wondering if we couldn't just use the existing
convert_dttm
here, as we should already have type casting logic in place for these types of conversions?superset/superset/db_engine_specs/presto.py
Lines 597 to 604 in 8ab45c9
Something like
query = query.where(Column(col_name) == cls.convert_dttm(column_type_by_name.get(col_name), value)
(not tested! thinking out loud)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.
Certainly possible but the drawbacks I see to re-using this existing method is that:
value
to a pythondatetime
to call the method only to get it converted back to a string with.isoformat
.from_iso8601_x
doesn't seem to be a recommended function anymore in the latest versions of Presto/Trino https://trino.io/docs/current/language/types.html#date-and-time