-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Refs #373 -- Added TupleIn subqueries. #18674
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
Refs #373 -- Added TupleIn subqueries. #18674
Conversation
7de4136
to
1c898e2
Compare
289ad42
to
629266d
Compare
buildbot, test on oracle. |
I've not seen us do this before. Doesn't mean it isn't something we do |
@sarahboyce , the idea is to
so yes the feature flag is not utilized for fallback in this patch but it will be in the next patch |
but if you think this is not the best approach then let me know what solution you would prefer - that's why it's good to have these smaller PRs so we can discuss these smaller things in detail 😊 maybe we don't need the feature flag at all? |
I don't know - maybe @charettes can confirm? |
If no core backends requires it today I'd suggest starting without a feature switch for now. We've seen third-party app maintainers be pretty reactive about requesting ones when needed. Thoughts on the above @timgraham? |
c3d8b3a
to
006ffb3
Compare
Thanks @charettes - alright, let's not worry about this right now, I suppose it's always easier to add it later than to remove it. @sarahboyce , I removed the feature switch. |
The backends I maintain (CockroachDB and Snowflake) don't require the feature flag. |
Given the concern about SQL Server specifically, maybe we should check with the maintainers of mssql-django? @mShan0 @absci do you have any thoughts here? |
006ffb3
to
8f702cf
Compare
Sorry, we're no longer maintaining mssql-django project, not sure what's the future plan. I don't know who's the new maintainer. |
I think it's safe to assume it's not maintained by anyone at the moment then? @sarahboyce , can we proceed without the feature flag? It's easy to add if someone requests it in the future. |
8f702cf
to
be3f837
Compare
Thank you for the input everybody! |
Trac ticket number
ticket-373
Branch description
Added the
supports_tuple_in_subquery
database feature.This enables developers to use
TupleIn
with subqueries, e.g.WHERE (foo, bar) IN (SELECT foo, bar FROM baz)
.This will be used by the feature requested by @LilyFoote (#18056 (comment)) later. The feature is the ability to UPDATE objects with composite primary keys + a subquery filter in one go (without pre-selecting the
pk
s first).e.g.:
See
SQLUpdateCompiler.pre_sql_setup
for more details (https://github.com/django/django/pull/18056/files#diff-f58de2deaccecd2d53199c5ca29e3e1050ec2adb80fb057cdfc0b4e6accdf14fR2128).While all supported database backends support this operation, we need a feature flag so 3rd party database backends that don't support it can disable it (e.g. SQL Server) and fall back to pre-selecting IDs before update.
Checklist
main
branch.