[Fixed]-Does Django natively support common table expressions?


Django doesn’t support CTEs directly as these are not common to all databases (MySQL pre-8.0 didn’t support it). There are packages that extend the capability of Django’s ORM to support CTEs. One of these is django-cte. Note that it only supports PostgreSQL.


It seems that nowadays django-cte is a better option. It works with the existing support for CTEs in underlying database engines.


Leave a comment