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


Python context.execute方法代码示例

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


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

示例1: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    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:HTTP-APIs,项目名称:hydrus,代码行数:21,代码来源:env.py

示例2: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    return  # We don't support offline
    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:airshipit,项目名称:drydock,代码行数:21,代码来源:env.py

示例3: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    url = config.get_main_option("sqlalchemy.url")
    context.configure(
        url=url,
        target_metadata=target_metadata,
        literal_binds=True,
        dialect_opts={"paramstyle": "named"},
    )

    with context.begin_transaction():
        context.run_migrations() 
开发者ID:everyclass,项目名称:everyclass-server,代码行数:24,代码来源:env.py

示例4: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    url = config.get_main_option("sqlalchemy.url")
    context.configure(url=url)

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

示例5: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    conf = config.conf
    context.configure(url=conf.indexer.url,
                      target_metadata=target_metadata)

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

示例6: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    url = os.environ['HAMMER_DATABASE_URL']
    context.configure(
        url=url,
        target_metadata=target_metadata,
        literal_binds=True,
        dialect_opts={"paramstyle": "named"},
    )

    with context.begin_transaction():
        context.run_migrations() 
开发者ID:asharov,项目名称:git-hammer,代码行数:24,代码来源:env.py

示例7: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    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:lablup,项目名称:backend.ai-manager,代码行数:20,代码来源:env.py

示例8: run_migrations_offline

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

    This configures the context with either a URL
    or an Engine.

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

    """
    set_mysql_engine()

    kwargs = dict()
    if neutron_config.database.connection:
        kwargs['url'] = neutron_config.database.connection
    else:
        kwargs['dialect_name'] = neutron_config.database.engine
    kwargs['include_object'] = include_object
    kwargs['version_table'] = SFC_VERSION_TABLE
    context.configure(**kwargs)

    with context.begin_transaction():
        context.run_migrations() 
开发者ID:openstack,项目名称:networking-sfc,代码行数:25,代码来源:env.py

示例9: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """

    context.configure(url=DBURL, target_metadata=target_metadata)

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

示例10: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    url = config.get_main_option('sqlalchemy.url')
    context.configure(url=url)

    with context.begin_transaction():
        context.run_migrations() 
开发者ID:PennyDreadfulMTG,项目名称:Penny-Dreadful-Tools,代码行数:19,代码来源:env.py

示例11: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    context.configure(
        url=meta.engine.url, target_metadata=target_metadata,
        literal_binds=True)
    with context.begin_transaction():
        context.run_migrations() 
开发者ID:jpush,项目名称:jbox,代码行数:19,代码来源:env.py

示例12: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.
    """
    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:ewels,项目名称:MegaQC,代码行数:19,代码来源:env.py

示例13: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

	"""
	context.configure(url=database_connection_url, target_metadata=target_metadata)

	with context.begin_transaction():
		context.run_migrations() 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:18,代码来源:env.py

示例14: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

    """
    url = config.get_main_option("sqlalchemy.url")
    context.configure(url=url,
                      include_object=include_object)

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

示例15: run_migrations_offline

# 需要导入模块: from alembic import context [as 别名]
# 或者: from alembic.context import execute [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.

	"""
	context.configure(url=context.config.get_section_option("lrrbot", "postgres", 'postgres:///lrrbot'),
		target_metadata=target_metadata, literal_binds=True)

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


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