当前位置: 首页>>代码示例>>Python>>正文


Python Operations.context方法代码示例

本文整理汇总了Python中alembic.operations.Operations.context方法的典型用法代码示例。如果您正苦于以下问题:Python Operations.context方法的具体用法?Python Operations.context怎么用?Python Operations.context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在alembic.operations.Operations的用法示例。


在下文中一共展示了Operations.context方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_migrations

# 需要导入模块: from alembic.operations import Operations [as 别名]
# 或者: from alembic.operations.Operations import context [as 别名]
    def run_migrations(self, **kw):
        """Run migrations as determined by the current command line
        configuration
        as well as versioning information present (or not) in the current
        database connection (if one is present).

        The function accepts optional ``**kw`` arguments.   If these are
        passed, they are sent directly to the ``upgrade()`` and
        ``downgrade()``
        functions within each target revision file.   By modifying the
        ``script.py.mako`` file so that the ``upgrade()`` and ``downgrade()``
        functions accept arguments, parameters can be passed here so that
        contextual information, usually information to identify a particular
        database in use, can be passed from a custom ``env.py`` script
        to the migration functions.

        This function requires that a :class:`.MigrationContext` has
        first been made available via :meth:`.configure`.

        """
        with Operations.context(self._migration_context):
            self.get_context().run_migrations(**kw)
开发者ID:BulletTrain,项目名称:me,代码行数:24,代码来源:environment.py


注:本文中的alembic.operations.Operations.context方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。