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
Catch exception in case of missing ds table #34595
base: master
Are you sure you want to change the base?
Conversation
try: | ||
with self.session_context() as session: | ||
session.execute(delete) | ||
except ProgrammingError: |
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.
Thanks for the revisit to the approach. Since ProgrammingError could come for different reasons, can we combine your original solution as
except ProgrammingError as e:
if not self.table_exists:
return
else:
raise e
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.
@mkangia Cool, let me make some updates
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 not self.table_exists: | ||
return | ||
else: | ||
raise e |
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.
nit:
Just noting that the else here is redundant. And a comment could be useful.
if not self.table_exists: # ignore error if table is missing
return
raise e
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.
Seems reasonable not going through QA but good to add tests for it though just for sanity
Not a bad idea. |
self.adapter = IndicatorSqlAdapter(config) | ||
|
||
def tearDown(self): | ||
self.adapter.drop_table() |
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.
this caused any trouble?
Replaces this PR, but with the difference being that we're catching the exception instead of checking whether or not the table exists.
Technical Summary
Ticket
An error was picked up by sentry in which a case made changes to a UCR that does not exist. This PR is simply to catch the error when the table does not exist and return, since no further work is necessary.
That said, I don't think this addresses the real problem, i.e. why the case change is propagated for this config which is supposedly deleted. This issue is to be investigated further, but this PR change will at least silence the error.
Feature Flag
UCRs
Safety Assurance
Safety story
--
Automated test coverage
No tests, don't think it's necessary for such a simple change.
QA Plan
No QA
Rollback instructions
Labels & Review