Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Charl1996
Copy link
Contributor

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

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@Charl1996 Charl1996 requested a review from mkangia May 10, 2024 08:35
@Charl1996 Charl1996 mentioned this pull request May 10, 2024
3 tasks
@Charl1996 Charl1996 marked this pull request as ready for review May 10, 2024 09:25
try:
with self.session_context() as session:
session.execute(delete)
except ProgrammingError:
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor

@mkangia mkangia left a 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

@Charl1996
Copy link
Contributor Author

Seems reasonable not going through QA but good to add tests for it though just for sanity

Not a bad idea.

@Charl1996
Copy link
Contributor Author

@mkangia see 495c64c for tests

self.adapter = IndicatorSqlAdapter(config)

def tearDown(self):
self.adapter.drop_table()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this caused any trouble?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants