#36912: Q.create() doesn't validate connectors as Q.__init__() does
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Anna
Type: | Makarudze
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: _connector security | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):
Hi Anna, thanks for these details. I agree the unpacking is the main
difference, and that was the main rationale for switching to `Q.create()`
more in 9dff316be41847c505ebf397e4a52a0a71e0acc4. From that commit
message:
> In addition, we were often needing to unpack iterables into *args and
can instead pass a list direct to Node.create().
In other words, we already had an iterable, so we were able to micro-
optimize out the unpacking by using `Q.create()`.
Maybe we could have our cake and eat it too by just overriding `create()`
on `Q` to do the necessary checking of valid connectors. This would allow
us to get the desired checking without the (possibly) undesired cost of
unpacking and sorting/repacking.
> I investigated the 2nd scenario only with django-asv and the benchmarks
indicated better performance for Q() than Q.create().
(At first glance, this seems surprising to me -- it's worth a second look
to ensure your bench is fully isolating what you wanted to measure.)
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/36912#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019d45d98366-0f4924ff-5431-4494-adc0-33a650aabde7-000000%40eu-central-1.amazonses.com.