env.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:triage 作者: dssg 项目源码 文件源码
def run_migrations_online():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

    """

    connectable = create_engine(
        url,
        poolclass=pool.NullPool
    )

    with connectable.connect() as connection:
        context.configure(
            connection=connection,
            target_metadata=target_metadata,
            version_table='results_schema_versions',
            include_schemas=True,
        )
        connection.execute('set search_path to "{}", public'.format('results'))

        with context.begin_transaction():
            context.run_migrations()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号