-
Notifications
You must be signed in to change notification settings - Fork 17
Some optimizations and fixes #102
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
base: master
Are you sure you want to change the base?
Conversation
Extra indent
max_primary_key = max(max_primary_key, record_primary_key) | ||
|
||
last_record = records[-1] | ||
max_primary_key = [self.to_date_if_str(last_record[key_idx]) for key_idx in primary_key_ids] |
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.
We should only attempt to convert for datetime or date types, not for arbitrary strings. Please do the following:
-
Get MySQL field types for primary keys (add it after line 300):
field_types_mysql = [field.field_type for field in mysql_table_structure.fields] primary_key_types_mysql = [field_types[key_idx] for key_idx in primary_key_ids]
-
Check if the type is datetime and only in this case try to convert it to dates.
It would be great to add some unit tests if you have time. See running tests section in README.md (it's optional) |
Please note that some existing tests seem to be failing; could you please take a look? |
I'm coding on python first time and on vacation atm :) |
They still failing.. here is a stack trace:
|
Forgot the last commit, did it |
Tests still failing (this time another test), see the build run, test is called
Anyway thanks a lot for the PR! Will merge it as soon as all test resolved. |
Row Constructor Expression eventually not used even by MySQL 8.1+ and so (col_a, col_b) > (a, b) leads to INDEX scan instead of RANGE scan when col_a > a OR (col_a = a AND col_b > b) used.
Speedup for queries about 20x in huge tables
We have to convert date as string ('2025-02-02') to date type because python can't compare str with date