-
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
feat(native-filters): add temporal support to select filter #13622
feat(native-filters): add temporal support to select filter #13622
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13622 +/- ##
==========================================
+ Coverage 72.77% 77.41% +4.63%
==========================================
Files 923 924 +1
Lines 46824 46923 +99
Branches 5746 5758 +12
==========================================
+ Hits 34077 36326 +2249
+ Misses 12531 10461 -2070
+ Partials 216 136 -80
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
7a44dc1
to
0c86e5d
Compare
@@ -145,7 +145,7 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: | |||
tt = target_type.upper() | |||
if tt == utils.TemporalType.DATE: | |||
return f"TO_DATE('{dttm.date().isoformat()}', 'YYYY-MM-DD')" | |||
if tt == utils.TemporalType.TIMESTAMP: | |||
if "TIMESTAMP" in tt or "DATETIME" in tt: |
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.
Previously "TIMESTAMP WITH TIMEZONE" was not being picked up, nor was "DATETIME" (utils.TemporalType
needs a good refactor, too, but will leave that to a follow-up PR)
0c86e5d
to
6c1899b
Compare
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.
LGTM ! I've tested out this locally and tests seems to be covering all changes
SUMMARY
Add support for temporal and boolean options to native filters. To facilitate this, a custom SQLAlchemy type is introduced to handle literal binds using
datetime
objects. In addition, the select Select filter component implements a formatter to show only the relevant digits of the timestamp -YYYY-MM-DD
for dates, andYYY-MM-DD HH:MM:SS
for hours-seconds and fullYYY-MM-DD HH:MM:SS.MMMMMM
for sub-second timestamps.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Dropdown options for filter on date column:
Dropdown options for filter on datetime column. Notice how the format adapts to only show the date if there are no hours, minutes or seconds:
Dropdown options on boolean column:
A bunch of filters enabled at the same time:
The rendered query:
TEST PLAN
ADDITIONAL INFORMATION