-
Notifications
You must be signed in to change notification settings - Fork 16.5k
fix: prevent ForeignKeyViolation error on delete #23414
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #23414 +/- ##
==========================================
+ Coverage 67.61% 67.63% +0.02%
==========================================
Files 1907 1908 +1
Lines 73590 73733 +143
Branches 7982 7989 +7
==========================================
+ Hits 49755 49871 +116
- Misses 21787 21814 +27
Partials 2048 2048
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
/testenv up |
|
@betodealmeida Ephemeral environment spinning up at http://35.87.238.215:8080. Credentials are |
|
Ephemeral environment shutdown and build artifacts deleted. |
|
|
||
| def run(self) -> Model: | ||
| self.validate() | ||
| self._model = cast(Slice, self._model) |
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.
is this necessary? The doc said This returns the value unchanged. but only good for type checker
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 needed to make the type checker happy.
On __init__ self._model will be set to None. When we call self.validate() it will either set self._model to a Slice or raise an exception, so here we're telling the type checker that we know self._model is of type Slice.
|
i'm facing this issue in 2.1.0 rc3 |
|
I'm facing this issue in 2.1.0. This version is still unstable ? |
SUMMARY
We've been seeing sporadic non-reproducible
ForeignKeyViolationerrors in our logs when users try to delete charts:And datasets:
Looking at the docs this shouldn't happen for secondary associations, though other people have reported the same problem. In order to fix it I changed the delete commands to manually clear the
ownersattribute, and also added anondeleteclause so that the database handles the cascade (in addition to SQLAlchemy).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION