我试图用SQLAlchemy表达式中的PostgresqlONLY
关键字生成一个查询:
示例1:用text()
表达式定义表名不起作用(除非我将字符串“ONLY”作为文本的一部分):
tbl = text('schema.table') # work with text('ONLY schema.table')
query = select([func.count()]).select_from(tbl).with_hint(tbl,
'ONLY',
'postgresql')
print query.compile(bind=engine)
印刷品:
^{pr2}$示例2:但是,如果我使用轻量级^{
tbl = table('schema.table')
query = select([func.count()]).select_from(tbl).with_hint(tbl,
'ONLY',
'postgresql')
print query.compile(bind=engine)
印刷品:
SELECT count(*) AS count_1
FROM ONLY "schema.table"
但这不好,因为名字的双引号
现在,请记住,我收到了一个模式限定表名的列表,我希望避免创建Table
和{
所以,我想说的是:
示例1:如何使ONLY
关键字出现?在
示例2:如何正确指定模式?在
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐