草庐IT

pending_migrations

全部标签

python - flask : changing location of 'migrations' folder

我有我的Flask项目层次结构aproject├──controllers└──models└──schema.py当我运行pythonschema.pydbinit时,migrations文件夹被添加到project而不是models。我在所有3个文件夹下都有一个__init__.py(为简洁起见,此处未显示)。我想要在models下生成migrations文件夹。我该怎么做? 最佳答案 嗯..就像Oluwafemi说的,你可以在cli命令中将-d(--directory)标志传递给你的管理器脚本pythonschema.pydb

python - CommandError : App 'books' has migrations. 应用有迁移时只能使用sqlmigrate和sqlflush命令

这个问题在这里已经有了答案:DjangoCommandError:App'polls'hasmigrations(5个答案)关闭3年前。我正在尝试了解python-django。我想制作名为books的自助应用。当我运行这个命令时$pythonmanage.pysqlallbooks出现以下错误CommandError:App'books'hasmigrations.Onlythesqlmigrateandsqlflushcommandscanbeusedwhenanapphasmigrations.我不明白为什么会出现这个错误,这是什么意思?任何帮助,将不胜感激。谢谢

python - 列 'django_migrations.id' 具有不受支持的类型 'serial' [使用 Amazon Redshift]

我使用django_celery连接到AmazonRedshift。要迁移数据库,在“makemigrations”之后我使用了命令“pythonmanage.pymigrate”,错误消息如下所示。原因是Redshift不支持数据类型“serial”,但包含“serial”类型的“django_migrations”表是自动创建的。如何停止Django迁移创建此表或避免在“django_migrations”表上使用序列号。D:\code\test_celery_django>pythonmanage.pymigrateTraceback(mostrecentcalllast):Fi

python - 为什么 django_migrations 表在所有数据库中

我在Django框架下建立一个网站,这个网站需要有不同的SQL方案,现在我成功地创建了所有方案和所有东西,但我不明白为什么迁移后每个模式中都有表django_migrations数据库。预期的数据库内容:AppDBtablesareallthemodelsdefinedbythisappDefaultDBtablesareallDjangotables(admin,contenttypes,auth,sessions)数据库内容:AppDBtablesareallthemodelsdefinedbythisapp+django_migrationsDEFAULTtablesareall

alembic - 使用 flask-migrate 时如何为 alembic_version 指定表模式

我在PostgreSQL中使用flask-migrate,当我执行pythonmanage.pydbupgrade命令时,它将在public模式中生成alembic_version表.如何在生成alembic_version表时更改默认架构? 最佳答案 有一个version_table_schemaconfigure()调用的参数。您可以在env.py文件中对其进行编辑。 关于alembic-使用flask-migrate时如何为alembic_version指定表模式,我们在Stack

python - django.db.migrations.exceptions.NodeNotFoundError

当我运行makemigrations命令时,出现了这个错误:Traceback(mostrecentcalllast):...django.db.migrations.exceptions.NodeNotFoundError:Migrationproducts.0002_auto_20160618_1143dependenciesreferencenonexistentparentnode(u'products',u'0001_initial') 最佳答案 如果您打开迁移文件products.0002_auto_20160618_1

python - 为什么我在 Python asyncio 中收到 "Task was destroyed but it is pending"错误?

我使用asyncio和漂亮的aiohttp。主要思想是我向服务器发出请求(它返回链接)然后我想从所有链接下载文件parallel(类似于example)。代码:importaiohttpimportasyncio@asyncio.coroutinedefdownloader(file):print('Download',file['title'])yieldfromasyncio.sleep(1.0)#someactionstodownloadprint('OK',file['title'])defrun():r=yieldfromaiohttp.request('get','my_u

python - 如何在 flask-migrate 迁移中自动导入模块

我的flask项目在其某些模型定义中使用了sqlalchemy_utils,这会导致迁移错误,例如:NameError:globalname'sqlalchemy_utils'isnotdefined由于这个包没有被导入到迁移文件中。我想让flask-migrate/alembic自动生成将这个包导入迁移文件的行,我该如何实现?我查看了alembic.ini和migrations/env.py-但我不清楚什么是正确的方法/如果可能的话。 最佳答案 最直接的方法是修改模板以包含该导入。script.py.mako:...fromale

python - flask-migrate 不检测模型

我正在阅读(和观看)有关Flask-Migrate的信息:https://realpython.com/blog/python/flask-by-example-part-2-postgres-sqlalchemy-and-alembic/在这里https://www.youtube.com/watch?v=YJibNSI-iaE#t=21并完成本教程中的所有操作:我启动了一个本地postgres服务器(使用Postgres.App,它在postgresql://localhost:5432启动了服务器)根据所述教程更新配置更新了app.py,创建了models.py等。安装Flask

python - 属性错误 : 'Graph' object has no attribute 'cypher' in migration of data from Postgress to Neo4j(Graph Database)

我正在手动将数据从postgres迁移到图形数据库。我写了下面的脚本:importpsycopg2frompy2neoimportauthenticate,Graphauthenticate("localhost:7474","neo4j","password")n4j_graph=Graph("http://localhost:7474/db/data/")try:conn=psycopg2.connect("dbname='db_name'user='user'password='password'")except:print"goodbye"cur=conn.cursor()tr