草庐IT

alembic_version

全部标签

python - 对 alembic.ini 使用不同的 .ini 文件

我正在尝试为我的Pyramid项目配置SQLAlchemyAlembic,我想使用我的developement.ini(或production.ini)来配置Alembic。是否可以指定我希望在Alembic中的任何位置使用的.ini文件? 最佳答案 运行alembic命令时只需指定alembic-c/some/path/to/another.ini。您甚至可以将[alembic]部分放在您的development.ini和production.ini文件中,而只是alembic-cproduction.iniupgradehead

python - Pandas v0.17.0 : AttributeError: 'unicode' object has no attribute 'version'

我在我的linuxsuse13.264位上直接从源代码安装了pandasv0.17.0。我之前使用yast安装了v0.14.1。现在>>>importpandasTraceback(mostrecentcalllast):File"",line1,inFile"/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/__init__.py",line44,infrompandas.core.apiimport*File"/usr/lib64/python2.7/site-package

python - 无法使用 Flask-Migrate (Alembic) 迁移或升级数据库

我一直在使用Flask-Migrate(Alembic)来更新我的数据库。我更新了我的models.py文件,但我犯了一个错误。我运行了一个迁移并去升级数据库,但是我得到了这个错误:sqlalchemy.exc.IntegrityError:(_mysql_exceptions.IntegrityError)(1215,'Cannotaddforeignkeyconstraint')[SQL:u'\nCREATETABLEtopics(\n\tidINTEGERNOTNULLAUTO_INCREMENT,\n\t`subjectID`INTEGER,\n\ttopicVARCHAR(1

python - 如何在 Alembic/SQLAlchemy 中使用 USING 子句?

我想使用Alembic将数据库的列类型从字符串更改为整数。如果我使用纯SQL,它可以实现目标:altertablestatistic_ticketaltercolumntagstypebigintusingtags::bigint;但是当我像这样使用Alembic时:importsqlalchemyassadefupgrade():op.alter_column('statistic_ticket','tags',nullable=True,existing_type=sa.String(length=255),type_=sa.Integer,existing_nullable=Tr

python - 安装 BlueJeans session API 客户端时出现 "pipenv requires an #egg fragment for version controlled dependencies"警告

改编来自https://github.com/bluejeans/api-rest-meetings/tree/master/libs/python#pip-install的说明,在pipenvshell我正在尝试运行pipenvinstallgit+https://github.com/bluejeans/api-rest-meetings.git@pip-repo但是,我收到以下错误消息:⠋WARNING:pipenvrequiresan#eggfragmentforversioncontrolleddependencies.Pleaseinstallremotedependenc

python - 如何在 Windows 上使用 pip install 修复错误 “Expected version spec in …”?

在Windows7机器上,我使用以下命令从本地目录安装包:pipinstalladdons/pnc_tests--upgrade--extra-index-url=http://some_server/simple这会导致以下错误:C:\Users\alex\PNC\tas\ENV\Scripts\pip-script.pyrunon07/16/1407:50:47Exception:Traceback(mostrecentcalllast):File"C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\basecommand.py",lin

python - 请求自动生成迁移的简单 alembic 工作示例

我从我的ubuntu安装了alembic0.3.4、sqlalchemy、SQLite版本3.7.4,并将SQLAlchemy0.6.4升级到SQLAlchemy0.7或更高版本。我关注了theinstructionslinkedhere:现在我正在测试:自动生成迁移我创建了一个包:模式,并在模式下创建了一个包标记:init.py定义一行:__all__=["teacher"]我还在schemas目录中创建了一个模块文件:dbmodel.py,内容如下Base=declarative_base()classteacher(Base):__tablename__='teacher'id=

python - Alembic + Sqlalchemy 多列唯一约束

我正在尝试使用sqlalchemy创建一个多列唯一约束,Alembic会在其自动升级脚本生成器中选取该约束。我已经使用以下方法创建约束:在我的模型中从sqlalchemyimportUniqueConstraintUniqueConstraint('col1','col2','number',name='uix_table_col1_col2_col3')但是,Alembic不会在其自动脚本生成中使用它。我可以通过添加在Alembic脚本中手动创建它。op.create_unique_constraint('uq_table_col1_col2_col3','table',['col1

python - 为 python 包创建一个 __version__ 属性而不会遇到麻烦

在阅读了python文档(http://www.python.org/dev/peps/pep-0396/)之后,我比以前更困惑如何正确地为包设置__version__属性。提到将它们放入setup.py文件,这让我感到困惑:它不会作为my_package.__version__提供,是吗?我最终从一个单独的文件中导入了版本属性。所以我的“版本”文件通常是my_package/__init__.pymy_module1/...my_module2/...my_module3/...info/__init__.pyversion.py__version__='0.1.0'在最上面的__i

python - 如何在 alembic 中使用 alter_column?

我正在用alembic编写迁移,但对我来说似乎不可能将server_defaults的值从有值变为无值。我的代码:op.alter_column("foo",sa.Column("bar",sa.DateTime(timezone=False),server_default=None,nullable=True))如果我在迁移后检查默认值仍然是NOW() 最佳答案 要从Alembic0.9.5开始重命名列,我必须将迁移更改为如下所示:op.alter_column('my_table','old_col_name',nullable