invenio_migrator/tasks/records.py
def import_record(data, source_type=None, latest_only=False):
    """Migrate a record from a migration dump.

    :param data: Dictionary for representing a single record and files.
    :param source_type: Determines if the MARCXML or the JSON dump is used.
        Default: ``marcxml``.
    :param latest_only: Determine is only the latest revision should be loaded.
    """
    source_type = source_type or 'marcxml'
    assert source_type in ['marcxml', 'json']

    recorddump = current_migrator.records_dump_cls(
        data,
        source_type=source_type,
        pid_fetchers=current_migrator.records_pid_fetchers,
    )
    try:
        current_migrator.records_dumploader_cls.create(recorddump)
        db.session.commit()
    except Exception:
        db.session.rollback()
        raise
def import_record(data, source_type=None, latest_only=False):
    source_type = source_type or 'marcxml'
    assert source_type in ['marcxml', 'json']

    recorddump = current_migrator.records_dump_cls(
        data,
        source_type=source_type,
        pid_fetchers=current_migrator.records_pid_fetchers,
    )
    try:
        current_migrator.records_dumploader_cls.create(recorddump)
        db.session.commit()
    except Exception:
        db.session.rollback()
        raise
def import_record ( data , source_type = None , latest_only = False ) : source_type = source_type or 'marcxml' assert source_type in [ 'marcxml' , 'json' ] recorddump = current_migrator . records_dump_cls ( data , source_type = source_type , pid_fetchers = current_migrator . records_pid_fetchers , ) try : current_migrator . records_dumploader_cls . create ( recorddump ) db . session . commit ( ) except Exception : db . session . rollback ( ) raise
Migrate a record from a migration dump.

    :param data: Dictionary for representing a single record and files.
    :param source_type: Determines if the MARCXML or the JSON dump is used.
        Default: ``marcxml``.
    :param latest_only: Determine is only the latest revision should be loaded.
Migrate a record from a migration dump .