Does Django natively support common table expressions?

一个人想着一个人 提交于 2019-12-08 15:31:02

问题


To clarify my question I would like to know if it is possible to idiomatically use the Django ORM whilst accessing CTE features. I imagine I could use CTE by writing raw SQL statements but the ability to use the ORM 'syntactic sugar' to bypass hand coding SQL statements was one of the original appeals of Django.


回答1:


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



来源:https://stackoverflow.com/questions/17498803/does-django-natively-support-common-table-expressions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!