-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref: upgrade to django 5.0 #64360
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
ref: upgrade to django 5.0 #64360
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
86d84cc to
9510e6f
Compare
05b8ddb to
af8f8b3
Compare
af8f8b3 to
d7ab5b0
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
0b6d331 to
ce3581c
Compare
ce3581c to
5c4b649
Compare
7e068d4 to
e3958c7
Compare
e3958c7 to
6a6d35b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #64360 +/- ##
==========================================
+ Coverage 80.07% 81.33% +1.25%
==========================================
Files 5237 5218 -19
Lines 231064 230905 -159
Branches 45322 45303 -19
==========================================
+ Hits 185025 187804 +2779
+ Misses 40023 37249 -2774
+ Partials 6016 5852 -164
|
wedamija
left a comment
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.
Looks good to me, I just want to check that you verified that Queryset.update hasn't significantly changed, since we should update this if so
sentry/src/sentry/db/models/manager/base_query_set.py
Lines 32 to 74 in c8a00d1
| def update_with_returning(self, returned_fields: list[str], **kwargs): | |
| """ | |
| Copied and modified from `Queryset.update()` to support `RETURNING <returned_fields>` | |
| """ | |
| self._not_support_combined_queries("update") # type: ignore[attr-defined] | |
| if self.query.is_sliced: | |
| raise TypeError("Cannot update a query once a slice has been taken.") | |
| self._for_write = True | |
| query = self.query.chain(sql.UpdateQuery) | |
| query.add_update_values(kwargs) # type: ignore[attr-defined] | |
| # Inline annotations in order_by(), if possible. | |
| new_order_by = [] | |
| for col in query.order_by: | |
| if annotation := query.annotations.get(col): | |
| if getattr(annotation, "contains_aggregate", False): | |
| raise exceptions.FieldError( | |
| f"Cannot update when ordering by an aggregate: {annotation}" | |
| ) | |
| new_order_by.append(annotation) | |
| else: | |
| new_order_by.append(col) | |
| query.order_by = tuple(new_order_by) | |
| # Clear any annotations so that they won't be present in subqueries. | |
| query.annotations = {} | |
| with transaction.mark_for_rollback_on_error(using=self.db): | |
| try: | |
| query_sql, query_params = query.get_compiler(self.db).as_sql() | |
| query_sql += f" RETURNING {', '.join(returned_fields)} " | |
| using = router.db_for_write(self.model) | |
| with connections[using].cursor() as cursor: | |
| cursor.execute(query_sql, query_params) | |
| result_ids = cursor.fetchall() | |
| except EmptyResultSet: | |
| # If Django detects that the query cannot return any results it'll raise | |
| # EmptyResultSet before we even run the query. Catch it and just return an | |
| # empty array of result ids | |
| result_ids = [] | |
| self._result_cache = None | |
| return result_ids |
I didn't, but it doesn't look like it has received any updates that we care about. there's a proposal to make |
Yeah, that seems to have been hanging around for years so I'm not holding my breath on it happening any time soon! |
🤞 yeahhhh -- though I've gotten to delete a lot of the hacky things we've got over time -- one day we'll have less of this stuff 😭 |
this avoids a transitional warning for updating the default from http we can technically remove this assignment once we are on django 6
send_robust got way more complicated in django 5.x to handle async signals
6a6d35b to
966cd42
Compare
No description provided.