gpt4 book ai didi

python - SQLAlchemy 可以使用 PostgreSQL 的 "from only"子句吗?

转载 作者:太空狗 更新时间:2023-10-30 00:07:59 25 4
gpt4 key购买 nike

我需要在选择查询中使用 PostgreSQL only 子句。我可以用 SQLAlchemy 做到这一点吗?

最佳答案

是的,前提是您使用 SQLAlchemy 版本 0.8.0 或更高版本(参见 issue 2506)。

ONLY 关键字作为选择提示实现:

result = table.select().with_hint(table, 'ONLY', 'postgresql')

或者当使用 ORM 层时,在查询对象上:

session.query(...).with_hint(MappedClass, 'ONLY', 'postgresql')

关于python - SQLAlchemy 可以使用 PostgreSQL 的 "from only"子句吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12014200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com