-
Notifications
You must be signed in to change notification settings - Fork 3
VED-1010: refactor audit table functions #1137
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?
VED-1010: refactor audit table functions #1137
Conversation
| ConditionExpression="attribute_exists(message_id)", | ||
| @staticmethod | ||
| def update_status(file_key: str, message_id: str, updated_status: str) -> None: | ||
| update_audit_table_item( |
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.
I imported the shared function here as the rest of this lambda is class/oop based so didn't think it was worth refactoring. Can do if needed.
| raise UnhandledAuditTableError(error) from error | ||
|
|
||
|
|
||
| def _build_update_expression_attribute_names_and_values( |
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.
Not sure about the name of this function. Happy to take suggestions or if it makes sense to others, leave as is.
Also not overly fond of reassigning and mutating the variables but hopefully I've made it clear that this func should be private and only used here. In which case I guess it's okay? Again, happy to take suggestions
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.
It's an ugly name but a fully descriptive one :)
Maybe there's no need to pass the empty dicts in at all - just create them as locals and return a tuple.
e77f040 to
0a71a35
Compare
…t_time in recordprocessor to use common update_audit_table_item
Also moved other audit table functions to shared file
88c6404 to
4ce8e4d
Compare
|
| "file_level_validation.set_audit_table_ingestion_start_time" | ||
| ) | ||
|
|
||
| self.update_audit_table_item_pather = patch("file_level_validation.update_audit_table_item") |
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.
Typo - should be 'patcher'
| def update_audit_table_item( | ||
| file_key: str, | ||
| message_id: str, | ||
| optional_params: dict[AuditTableKeys, any], |
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.
As Dan said, they're not really optional parameters. If we pass { }, then we end up calling update_item() with an unchanged item. If we pass None, then optional_parameters.items() will raise an AttributeError.



Summary
Consolidate audit table related functions for the batch flow into the shared code directory.
Reviews Required
Review Checklist
ℹ️ This section is to be filled in by the reviewer.