Common import functions for both database backend
aiida.tools.importexport.dbimport.backends.common.
_copy_node_repositories
Copy repositories of new nodes from the archive to the AiiDa profile.
uuids_to_create – the node UUIDs to copy
reader – the archive reader
_make_import_group
Make an import group containing all imported nodes.
group – Use an existing group
node_pks – node pks to add to group
_sanitize_extras
Remove unwanted extra keys.
fields – the database fields for the entity
Django-specific import of AiiDA entities
aiida.tools.importexport.dbimport.backends.django.
_add_nodes_to_groups
Add nodes to imported groups.
_select_entity_data
Select the data to import by comparing the AiiDA database to the archive contents.
_store_entity_data
Store the entity data on the AiiDA profile.
_store_node_links
Store node links to the database.
import_data_dj
Import exported AiiDA archive to the AiiDA database and repository.
Specific for the Django backend. 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.
in_path
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.
Group
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 nodes (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).
New and existing Nodes and Links.
dict
ImportValidationError – if parameters or the contents of metadata.json or data.json can not be validated.
CorruptArchive – if the provided archive at in_path is corrupted.
IncompatibleArchiveVersionError – if the provided archive’s export version is not equal to the export version of AiiDA at the moment of import.
ArchiveImportError – if there are any internal errors when importing.
ImportUniquenessError – if a new unique entity can not be created.
SQLAlchemy-specific import of AiiDA entities
aiida.tools.importexport.dbimport.backends.sqla.
import_data_sqla
Specific for the SQLAlchemy backend. 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.
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).
silent (bool) – suppress progress bar and summary.
sql_transaction
A context manager for the transaction.