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