def add_repository(config, repository, namespace, name, shard, **kw):
    """ This function is used as a directive of Pyramid Config
    and responsible for registering available SQL repositories.

    :param config: Pyramid configurator instance
    :type config: :class:`pyramid.config.Configurator`
    :param repository: repository class object
    :param namespace: database namespace
    :type namespace: str
    :param name: database name, must be unique
    :type name: str
    :param shard: database shard
    :type shard: str
    """
    repositories = config.registry.settings.setdefault(
        'pacific.db.repositories', {})
    repositories[name] = {'repository': repository, 'namespace': namespace,
        'shard': shard}
