【发布时间】:2017-06-08 21:02:42
【问题描述】:
按照这个问题,SQLAlchemy - SQLite for testing and Postgresql for development - How to port?
我意识到,(以上)共识是不要使用未在生产中使用的数据库进行测试。
我想抽象出对 sqlalchemy 的 部分索引 支持,以便我可以使用 Postgres 或 Sqlite。
我已经看到 PostgreSQL 可以使用
Index('only_one_active_invoice',
invoice_id, active,
unique=True,
postgresql_where=(active)
),
但我看到sqlitehttps://sqlite.org/partialindex.html也支持部分索引
是否有某种对 sqlalchemy 的通用部分索引支持,我的模块可以用于 postgres 或 sqlite 数据库?
【问题讨论】:
标签: python postgresql sqlite sqlalchemy partial-index