-
Notifications
You must be signed in to change notification settings - Fork 87
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
Case sensitive/insensitive table validation #3580
base: main
Are you sure you want to change the base?
Conversation
✅ 3/3 passed, 2m45s total Running from acceptance #8144 |
18ac91b
to
bdff18c
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.
Some suggestions to make it a bit cleaner.
How do users pass the flag to the metadata comparison?
c5a6d4f
to
1ca97ab
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, final nits
self._metadata_retriever = metadata_retriever | ||
self._case_sensitive = case_sensitive | ||
|
||
def _column_name_transformer(self) -> Callable[[str], str]: |
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.
More accurate would be to call it a factory here to signal it produces a callable
def _column_name_transformer(self) -> Callable[[str], str]: | |
def _column_name_transformer_factory(self) -> Callable[[str], str]: |
if self._case_sensitive: | ||
return lambda _: _ | ||
return str.lower |
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.
if self._case_sensitive: | |
return lambda _: _ | |
return str.lower | |
return str if self._case_sensitive else str.lower |
source_metadata = self._metadata_retriever.get_metadata( | ||
source, column_name_transformer=self._column_name_transformer() | ||
) | ||
target_metadata = self._metadata_retriever.get_metadata( | ||
target, column_name_transformer=self._column_name_transformer() | ||
) |
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.
Does not really matter, but my OCD likes to initialize the transformer once. Also, I prefer the full names, but would accept a shorter name within a small code block to increase readability with all statements being single lines
source_metadata = self._metadata_retriever.get_metadata( | |
source, column_name_transformer=self._column_name_transformer() | |
) | |
target_metadata = self._metadata_retriever.get_metadata( | |
target, column_name_transformer=self._column_name_transformer() | |
) | |
transformer = self._column_name_transformer() | |
source_metadata = self._metadata_retriever.get_metadata(source, column_name_transformer=transformer) | |
target_metadata = self._metadata_retriever.get_metadata(target, column_name_transformer=transformer) |
closes #3568
Added case sensitive flag for metadata comparison. To consider/ignore column name case.