sqlalchemy - 没有数据库的 Alembic 迁移

标签 sqlalchemy django-south django-migrations alembic

是否可以使用 Alembic auto-generate migrations没有访问数据库的权限?

例如 django/south 可以通过 comparing the current version of a Model against a previous snapshot of the Model 做到这一点.

最佳答案

不,这是不可能的。在 the relevant issue zzzeek 说

while the reflection-based comparison has its issues, it really is a very fundamental assumption these days particularly in the openstack world where autogen features are used in unit test suites to ensure the migrated schema matches the model. I don't have plans right now to pursue the datafile-based approach, it would be an enormous undertaking for a system that people seem to be mostly OK with as is.



尽管另一种方法可能是按需启动一个新数据库,从空到头运行迁移,针对它生成,然后丢弃数据库。

关于sqlalchemy - 没有数据库的 Alembic 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35329752/

相关文章:

security - 如何在 SQLAlchemy 中使用双引号转义

django - 不小心删除了我的django南迁移目录

django - 无法创建 django_migrations 表 (ORA-02000 : missing ALWAYS keyword)

python - 更改生成的迁移文件的基本路径

django - 如何判断迁移是否可逆?

Python+sqlAlchemy : change dtype object to string dynamically

python - SQLAlchemy 急切加载递归模型

django - 如何解决不存在的字段的完整性错误?

django - 向数据库添加初始数据

pandas - dask read_sql_table 在具有数字日期时间的 sqlite 表上失败