Ensure Date(time) fields are only converted to Nullable when they're not in the primary key #226
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.
As I reported in this issue, the fact that all Datetime fields are converted to
Nullable
caused synchronization issues when these fields are part of the table's primary key.With this PR, I propose that this conversion to
Nullable
is only done when the field is not part of the table's primary key.Implementation details:
to_sql_type
method not to convert Datetime fields toNullable
by default.to_sql_type_non_primary_key
method that ensures Datatime fields are converted toNullable
.create_empty_table
to callto_sql_type_non_primary_key
when the field is not part of the primary key, callingto_sql_type
otherwise.While there, formatted the code of
connectors.py
withruff
formatter to reduce the number of warnings/violations returned bypre-commit
. It seems that a lot of other files are also not formatted, but decided to keep the number of non-functional code changes to a minimum.