aiida.tools.importexport.dbimport package

Provides import functionalities.

aiida.tools.importexport.dbimport.import_data(in_path, group=None, **kwargs)[source]

Import exported AiiDA archive to the AiiDA database and repository.

Proxy function for the backend-specific import functions. If in_path is a folder, calls extract_tree; otherwise, tries to detect the compression format (zip, tar.gz, tar.bz2, …) and calls the correct function.

Note, the logging level and progress reporter should be set externally, for example:

from aiida.common.progress_reporter import set_progress_bar_tqdm

IMPORT_LOGGER.setLevel('DEBUG')
set_progress_bar_tqdm(leave=True)
import_data(...)

Deprecated since version 1.5.0: Support for the parameter silent will be removed in v2.0.0. Please set the log level and progress bar implementation independently.

Parameters
  • in_path (str) – the path to a file or folder that can be imported in AiiDA.

  • group (Group) – Group wherein all imported Nodes will be placed.

  • extras_mode_existing (str) – 3 letter code that will identify what to do with the extras import. The first letter acts on extras that are present in the original node and not present in the imported node. Can be either: ‘k’ (keep it) or ‘n’ (do not keep it). The second letter acts on the imported extras that are not present in the original node. Can be either: ‘c’ (create it) or ‘n’ (do not create it). The third letter defines what to do in case of a name collision. Can be either: ‘l’ (leave the old value), ‘u’ (update with a new value), ‘d’ (delete the extra), or ‘a’ (ask what to do if the content is different).

  • extras_mode_new (str) – ‘import’ to import extras of new nodes or ‘none’ to ignore them

  • comment_mode (str) – Comment import modes (when same UUIDs are found). Can be either: ‘newest’ (will keep the Comment with the most recent modification time (mtime)) or ‘overwrite’ (will overwrite existing Comments with the ones from the import file).

Returns

New and existing Nodes and Links.

Return type

dict

Raises

ArchiveImportError – if there are any internal errors when importing.

Submodules

Utility functions for import of AiiDA entities

aiida.tools.importexport.dbimport.utils.deserialize_attributes(attributes_data, conversion_data)[source]

Deserialize attributes

aiida.tools.importexport.dbimport.utils.deserialize_field(key, value, fields_info, import_unique_ids_mappings, foreign_ids_reverse_mappings)[source]

Deserialize field using deserialize attributes

aiida.tools.importexport.dbimport.utils.merge_comment(incoming_comment, comment_mode)[source]

Merge comment according comment_mode :return: New UUID if new Comment should be created, else None.

aiida.tools.importexport.dbimport.utils.merge_extras(old_extras, new_extras, mode)[source]
Parameters
  • old_extras – a dictionary containing the old extras of an already existing node

  • new_extras – a dictionary containing the new extras of an imported node

  • extras_mode_existing – 3 letter code that will identify what to do with the extras import. The first letter acts on extras that are present in the original node and not present in the imported node. Can be either k (keep it) or n (do not keep it). The second letter acts on the imported extras that are not present in the original node. Can be either c (create it) or n (do not create it). The third letter says what to do in case of a name collision. Can be l (leave the old value), u (update with a new value), d (delete the extra), a (ask what to do if the content is different).

aiida.tools.importexport.dbimport.utils.result_summary(results, import_group_label)[source]

Summarize import results

aiida.tools.importexport.dbimport.utils.start_summary(archive, comment_mode, extras_mode_new, extras_mode_existing)[source]

Print starting summary for import