python - SQLAlchemy 在合并上设置索引

标签 python sqlalchemy

我正在尝试在合并函数上而不是在列上为表设置索引。我正在使用 PostgreSQL,我正在尝试实现类似的目标:

使用 btree 在 tbl 上创建索引 t (coalesce(ts_updated, '2002-08-08'))

有人知道如何在 ORM 框架中使用 SQLAlchemy 实现这一点吗?

最佳答案

SQLAlchemy 尚不支持索引定义中的表达式,但它是 planned feature 。现在你必须使用custom DDL (see examples in documentation) .

关于python - SQLAlchemy 在合并上设置索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4407031/

相关文章:

python - 如何使用 SQLAlchemy 过滤带有 LIKE 的连接列?

python - 如何部署 Python/SQLAlchemy 应用程序?

python - 嵌套字典 : sum values of same key of the dictionaries nested as a value of dictionary

python - 如何在 python 中使用 SQLAlchemy SQL-builder 执行 UPDATE 查询?

python - SQLAlchemy for Python, 'Query' 对象没有属性 'fetchone'

python - 使用 Colanderalchemy 进行 Cornice 模式验证

python - 如何从 child 级联删除到 parent

给出错误答案的 Python N 体模拟代码

python - 使用 NLTK 对德语文本进行 POS 标记

python - Mac OS X Python GUI 管理员提示