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


Python context.get_x_argument方法代码示例

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


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

示例1: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import get_x_argument [as 别名]
def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.

    Calls to context.execute() here emit the given string to the
    script output.

    """

    # if a database path was provided, override the one in alembic.ini
    database = context.get_x_argument(as_dictionary=True).get('database')
    if database:
        url = "sqlite:///%s" % database
    else:
        url = config.get_main_option("sqlalchemy.url")

    context.configure(
        url=url, target_metadata=target_metadata, literal_binds=True)

    with context.begin_transaction():
        context.run_migrations() 
开发者ID:iranzo,项目名称:stampython,代码行数:27,代码来源:env.py

示例2: get_url

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import get_x_argument [as 别名]
def get_url():
    "Database URL must be specified on command line with -x url=<DB_URL>"
    url = context.get_x_argument(as_dictionary=True).get('url')
    return url 
开发者ID:analyseether,项目名称:ether_sql,代码行数:6,代码来源:env.py

示例3: upgrade

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import get_x_argument [as 别名]
def upgrade():
    schema_upgrades()
    # if context.get_x_argument(as_dictionary=True).get('data', None):
    #     data_upgrades() 
开发者ID:cmdmnt,项目名称:commandment,代码行数:6,代码来源:1005dc7dea01_os_update_settings.py

示例4: downgrade

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import get_x_argument [as 别名]
def downgrade():
    # if context.get_x_argument(as_dictionary=True).get('data', None):
    #     data_downgrades()
    schema_downgrades() 
开发者ID:cmdmnt,项目名称:commandment,代码行数:6,代码来源:1005dc7dea01_os_update_settings.py


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