コード例 #1
0
ファイル: distributed.py プロジェクト: jaytaylor/sh_util
def multiShardExec(sql):
    """Execute a statement across all shards."""
    from sh_util.sharding import ShardedResource
    from . import db_exec

    for connectionName in ShardedResource.allShardConnectionNames():
        db_exec(sql, using=connectionName)
コード例 #2
0
ファイル: distributed.py プロジェクト: Sendhub/sh_util
def _resolveConnectionsOrShards(connections=None):
    """
    When connections is None, all shards will be returned, otherwise connections is returned unmodified.

    @param connections mixed List of connection names or Dict of handle->psqlConnectionString.  Defaults to None.  If
        None, all primary shard connections will be used.
    """
    if connections is None:
        # Default to all shards.
        from sh_util.sharding import ShardedResource
        return ShardedResource.allShardConnectionNames()

    else:
        return connections
コード例 #3
0
def _resolveConnectionsOrShards(connections=None):
    """
    When connections is None, all shards will be returned, otherwise connections is returned unmodified.

    @param connections mixed List of connection names or Dict of handle->psqlConnectionString.  Defaults to None.  If
        None, all primary shard connections will be used.
    """
    if connections is None:
        # Default to all shards.
        from sh_util.sharding import ShardedResource
        return ShardedResource.allShardConnectionNames()

    else:
        return connections
コード例 #4
0
def multiShardExec(sql):
    """Execute a statement across all shards."""
    from sh_util.sharding import ShardedResource
    from . import db_exec
    for connectionName in ShardedResource.allShardConnectionNames():
        db_exec(sql, using=connectionName)