Thank you Russ and Michael. For the reference of other users and to get
feedback, here's what I ended up
doing: https://gist.github.com/anonymous/154512b369fe7e273631
import itertools
from django.db import connection
"""
Combine SQL and ORM.
sql = 'SELECT * FROM ( {} ) T1 NATURAL FULL OUTER J
The internals of the ORM are deemed a private API and have undergone
significant changes in the past without being constrained by the two
release deprecation cycle. As some one who was forced to write query
construction code based upon Django internals, my recommendation is to only
do that if y
Hi Russ,
Thank you for your answer. I am aware of raw. However, that's now what I am
looking for. Let me give a few examples of queries that I would like to
write:
1) Window functions over an ORM query:
SELECT "date", SUM("weight__sum") OVER (ORDER BY "date")
FROM
(
MyModel.objects.values('
Hi Suriya,
It sounds like you're looking for raw SQL queries:
https://docs.djangoproject.com/en/1.8/topics/db/sql/#performing-raw-queries
This allows you to issue a SQL query in SQL, rather than trying to bend the
ORM to meet some complex query requirement.
You can't compose a raw query like a
Hello,
I have to write some complex SQL queries that I am unable to express using
the ORM. I construct these complex queries by writing a few simple ORM
queries, getting the SQL using QuerySet.query and combining them with
various SQL operators manually. These hand-crafted queries are not very
5 matches
Mail list logo