Is it possible to use the with statement in a django queryset? Something like an extra param. I could use .raw, but I was just wondering if this was a way to go (by overriding the Query class possibly or some other route)
For reference, this needs to go before the select statement.
So:
with blah as (select * from table)
select * from blah where blah.column is not null
This is how I did it:
Basically, I just used the entire sql generated by django to create another with subquery. From there, I used that in the subsequent queries.