fix: Handle python_date_format in ExploreMixin #24068
Conversation
|
Snap @betodealmeida this is the same logic as #24062. I've rebased my logic on your PR. I also added some unit tests as I realized these were missing. |
8012cf7 to
bd074d4
Compare
c4db792 to
6498420
Compare
There was a problem hiding this comment.
In the TableColumn.dttm_sql_literal method this the db_extra is set. I gather it might have been set to None previously for connivence/ease.
Sorry for not adding tests, this was blocking a release and we needed a quick fix. |
Codecov Report
@@ Coverage Diff @@
## master #24068 +/- ##
==========================================
+ Coverage 68.22% 68.25% +0.02%
==========================================
Files 1942 1942
Lines 75215 75192 -23
Branches 8145 8145
==========================================
+ Hits 51318 51322 +4
+ Misses 21812 21785 -27
Partials 2085 2085
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
6498420 to
cd38854
Compare
cd38854 to
3e36553
Compare
SUMMARY
This PR fixes an issue introduced in #20938 however it didn't surface until #22853 which resulted in a somewhat bad correctness regression as the resulting generated SQL was incorrect when filtering the temporal column, i.e., rather than queries being generated of the form,
they were being generated as:
which due to lexicographical ordering would wrongfully exclude any records where
ds=2023-01-01.The TL;DR is #20938 replicated logic from the
TableColumnclass however it did not include the logic which adhered to the Python date/time format meaning that columns which weren't handled by the DB engine specconvert_dttmmethod were cast to an ISO 8601 formatted string adhering to theY-%m-%d %H:%M:%S.%fformat.This PR adds the missing logic and removes the now unused (per #22853)
TableColumnmethods to help improve the code hygiene and readability—having two or more instances of the same function makes the code very difficult to grok. @hughhhh I would suggest you perform a second pass to make sure all the legacy logic which was ported to theExploreMixinhas been removed.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Added unit tests which would have hopefully helped discovered the issue.
ADDITIONAL INFORMATION