當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。