當前位置: 首頁>>代碼示例>>Python>>正文


Python provision.FOLLOWER_IDENT屬性代碼示例

本文整理匯總了Python中sqlalchemy.testing.provision.FOLLOWER_IDENT屬性的典型用法代碼示例。如果您正苦於以下問題:Python provision.FOLLOWER_IDENT屬性的具體用法?Python provision.FOLLOWER_IDENT怎麽用?Python provision.FOLLOWER_IDENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在sqlalchemy.testing.provision的用法示例。


在下文中一共展示了provision.FOLLOWER_IDENT屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _init_dbs

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def _init_dbs(self):
        db1 = testing_engine(
            "sqlite:///shard1_%s.db" % provision.FOLLOWER_IDENT,
            options=dict(poolclass=SingletonThreadPool),
        )
        db2 = testing_engine(
            "sqlite:///shard2_%s.db" % provision.FOLLOWER_IDENT
        )
        db3 = testing_engine(
            "sqlite:///shard3_%s.db" % provision.FOLLOWER_IDENT
        )
        db4 = testing_engine(
            "sqlite:///shard4_%s.db" % provision.FOLLOWER_IDENT
        )

        self.dbs = [db1, db2, db3, db4]
        return self.dbs 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:19,代碼來源:test_horizontal_shard.py

示例2: configure_follower

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def configure_follower(follower_ident):
    """Configure required state for a follower.

    This invokes in the parent process and typically includes
    database creation.

    """
    from sqlalchemy.testing import provision
    provision.FOLLOWER_IDENT = follower_ident 
開發者ID:jpush,項目名稱:jbox,代碼行數:11,代碼來源:plugin_base.py

示例3: _engine_uri

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r'[,\s]+', db_token):
                if db not in file_config.options('db'):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris."
                        % db)
                else:
                    db_urls.append(file_config.get('db', db))

    if not db_urls:
        db_urls.append(file_config.get('db', 'default'))

    for db_url in db_urls:
        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT)

        if not config._current:
            cfg.set_as_current(cfg, testing) 
開發者ID:jpush,項目名稱:jbox,代碼行數:32,代碼來源:plugin_base.py

示例4: _get_staging_directory

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def _get_staging_directory():
    if provision.FOLLOWER_IDENT:
        return "scratch_%s" % provision.FOLLOWER_IDENT
    else:
        return "scratch" 
開發者ID:sqlalchemy,項目名稱:alembic,代碼行數:7,代碼來源:env.py

示例5: _engine_uri

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r'[,\s]+', db_token):
                if db not in file_config.options('db'):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris."
                        % db)
                else:
                    db_urls.append(file_config.get('db', db))

    if not db_urls:
        db_urls.append(file_config.get('db', 'default'))

    config._current = None
    for db_url in db_urls:

        if options.write_idents and provision.FOLLOWER_IDENT: # != 'master':
            with open(options.write_idents, "a") as file_:
                file_.write(provision.FOLLOWER_IDENT + " " + db_url + "\n")

        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT)

        if not config._current:
            cfg.set_as_current(cfg, testing) 
開發者ID:yfauser,項目名稱:planespotter,代碼行數:38,代碼來源:plugin_base.py

示例6: _engine_uri

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r'[,\s]+', db_token):
                if db not in file_config.options('db'):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris."
                        % db)
                else:
                    db_urls.append(file_config.get('db', db))

    if not db_urls:
        db_urls.append(file_config.get('db', 'default'))

    config._current = None
    for db_url in db_urls:
        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT)

        if not config._current:
            cfg.set_as_current(cfg, testing) 
開發者ID:eirannejad,項目名稱:pyRevit,代碼行數:33,代碼來源:plugin_base.py

示例7: configure_follower

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def configure_follower(follower_ident):
    """Configure required state for a follower.

    This invokes in the parent process and typically includes
    database creation.

    """
    from sqlalchemy.testing import provision

    provision.FOLLOWER_IDENT = follower_ident 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:12,代碼來源:plugin_base.py

示例8: _engine_uri

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r"[,\s]+", db_token):
                if db not in file_config.options("db"):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris." % db
                    )
                else:
                    db_urls.append(file_config.get("db", db))

    if not db_urls:
        db_urls.append(file_config.get("db", "default"))

    config._current = None
    for db_url in db_urls:

        if options.write_idents and provision.FOLLOWER_IDENT:  # != 'master':
            with open(options.write_idents, "a") as file_:
                file_.write(provision.FOLLOWER_IDENT + " " + db_url + "\n")

        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT
        )

        if not config._current:
            cfg.set_as_current(cfg, testing) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:39,代碼來源:plugin_base.py

示例9: teardown

# 需要導入模塊: from sqlalchemy.testing import provision [as 別名]
# 或者: from sqlalchemy.testing.provision import FOLLOWER_IDENT [as 別名]
def teardown(self):
        clear_mappers()

        for db in self.dbs:
            db.connect().invalidate()
        for i in range(1, 5):
            os.remove("shard%d_%s.db" % (i, provision.FOLLOWER_IDENT)) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:9,代碼來源:test_horizontal_shard.py


注:本文中的sqlalchemy.testing.provision.FOLLOWER_IDENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。