[Django] #24886: Add process_lhs() method for Transform

10 views
Skip to first unread message

Django

unread,
Jun 1, 2015, 3:29:00 AM6/1/15
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The Lookup class has two methods, process_rhs() and process_lhs(). Typical
usage is:
{{{
def as_sql(self, compiler, connection):
lhs_sql, lhs_params = self.process_lhs(compiler, connection)
rhs_sql, rhs_params = self.process_rhs(compiler, connection)
# return the sql
}}}

The typical usage for transforms is:
{{{
def as_sql(self, compiler, connection):
lhs_sql, lhs_params = compiler.compile(self.lhs)
# return the sql
}}}

I think it could make sense to add process_lhs() to transform base class.
This way one could write transforms using the same process_lhs() method
that is used for Lookups, too. At least for me it is hard to remember when
to use process_lhs() and when to use compiler.compile.

--
Ticket URL: <https://code.djangoproject.com/ticket/24886>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 4, 2015, 7:46:50 AM6/4/15
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mjtamlyn):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24886#comment:1>

Django

unread,
Jun 4, 2015, 10:14:12 AM6/4/15
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by jarshwah):

Could I suggest going the other way and standardising on
`compiler.compile` rather than `process_X`? I'm not sure how much work
process_lhs does in the normal lookups, so it may not be feasible. But I'd
like to standardise on the expressions way to ease the gap between them.

--
Ticket URL: <https://code.djangoproject.com/ticket/24886#comment:2>

Django

unread,
Sep 17, 2025, 1:09:16 PM (4 days ago) Sep 17
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: Samriddha
Type: | Kumar Tripathi
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Samriddha Kumar Tripathi):

* cc: Samriddha Kumar Tripathi (added)
* owner: nobody => Samriddha Kumar Tripathi
* status: new => assigned

Comment:

Hi, I’ve been exploring this ticket and would like to try working on it. I
noticed it’s been open for a while, so I’ll first check whether the
proposed change still applies to the current codebase. I’m still learning
the internals, but I’ll start by reviewing how Transform and Lookup handle
SQL compilation and see if adding process_lhs() improves consistency. I’ll
share any progress or questions here as I go.
--
Ticket URL: <https://code.djangoproject.com/ticket/24886#comment:3>

Django

unread,
Sep 19, 2025, 2:23:27 PM (2 days ago) Sep 19
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: Samriddha
Type: | Kumar Tripathi
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1
* needs_better_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/19885 PR]

Thanks for the PR. Don't forget to uncheck Patch Needs Improvement on this
ticket when tests are passing to signal you're ready for a review.
--
Ticket URL: <https://code.djangoproject.com/ticket/24886#comment:4>

Django

unread,
Sep 19, 2025, 2:31:04 PM (2 days ago) Sep 19
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: Samriddha
Type: | Kumar Tripathi
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Samriddha Kumar Tripathi):

Got it, I’ll uncheck the box once the tests pass. Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/24886#comment:5>

Django

unread,
Sep 20, 2025, 3:59:42 AM (yesterday) Sep 20
to django-...@googlegroups.com
#24886: Add process_lhs() method for Transform
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: Samriddha
Type: | Kumar Tripathi
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Samriddha Kumar Tripathi):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/24886#comment:6>
Reply all
Reply to author
Forward
0 new messages