invenio_migrator/cli.py
def loadrecords(sources, source_type, recid):
    """Load records migration dump."""
    # Load all record dumps up-front and find the specific JSON
    if recid is not None:
        for source in sources:
            records = json.load(source)
            for item in records:
                if str(item['recid']) == str(recid):
                    _loadrecord(item, source_type, eager=True)
                    click.echo("Record '{recid}' loaded.".format(recid=recid))
                    return
        click.echo("Record '{recid}' not found.".format(recid=recid))
    else:
        for idx, source in enumerate(sources, 1):
            click.echo('Loading dump {0} of {1} ({2})'.format(
                idx, len(sources), source.name))
            data = json.load(source)
            with click.progressbar(data) as records:
                for item in records:
                    _loadrecord(item, source_type)
def loadrecords(sources, source_type, recid):
    """Load records migration dump."""
    # Load all record dumps up-front and find the specific JSON
    if recid is not None:
        for source in sources:
            records = json.load(source)
            for item in records:
                if str(item['recid']) == str(recid):
                    _loadrecord(item, source_type, eager=True)
                    click.echo("Record '{recid}' loaded.".format(recid=recid))
                    return
        click.echo("Record '{recid}' not found.".format(recid=recid))
    else:
        for idx, source in enumerate(sources, 1):
            click.echo('Loading dump {0} of {1} ({2})'.format(
                idx, len(sources), source.name))
            data = json.load(source)
            with click.progressbar(data) as records:
                for item in records:
                    _loadrecord(item, source_type)
Load records migration dump.