aiida.backends.general package


Manage AiiDA queries.

class aiida.backends.general.abstractqueries.AbstractQueryManager(backend)[source]

Bases: abc.ABC

Manage AiiDA queries.

__abstractmethods__ = frozenset({})
__dict__ = mappingproxy({'__module__': 'aiida.backends.general.abstractqueries', '__doc__': 'Manage AiiDA queries.', '__init__': <function AbstractQueryManager.__init__>, 'get_duplicate_uuids': <function AbstractQueryManager.get_duplicate_uuids>, 'apply_new_uuid_mapping': <function AbstractQueryManager.apply_new_uuid_mapping>, 'get_creation_statistics': <staticmethod object>, '_extract_formula': <staticmethod object>, 'get_bands_and_parents_structure': <function AbstractQueryManager.get_bands_and_parents_structure>, 'get_all_parents': <staticmethod object>, '__dict__': <attribute '__dict__' of 'AbstractQueryManager' objects>, '__weakref__': <attribute '__weakref__' of 'AbstractQueryManager' objects>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc_data object>})

backend (aiida.orm.implementation.sql.backends.SqlBackend) – The AiiDA backend

__module__ = 'aiida.backends.general.abstractqueries'

list of weak references to the object (if defined)

_abc_impl = <_abc_data object>
static _extract_formula(akinds, asites, args)[source]

Extract formula from the structure object.

  • akinds – list of kinds, e.g. [{‘mass’: 55.845, ‘name’: ‘Fe’, ‘symbols’: [‘Fe’], ‘weights’: [1.0]}, {‘mass’: 15.9994, ‘name’: ‘O’, ‘symbols’: [‘O’], ‘weights’: [1.0]}]

  • asites – list of structure sites e.g. [{‘position’: [0.0, 0.0, 0.0], ‘kind_name’: ‘Fe’}, {‘position’: [2.0, 2.0, 2.0], ‘kind_name’: ‘O’}]

  • args (dict) – a namespace with parsed command line parameters, here only ‘element’ and ‘element_only’ are used


a string with formula if the formula is found

apply_new_uuid_mapping(table, mapping)[source]
static get_all_parents(node_pks, return_values='id')[source]

Get all the parents of given nodes


node_pks – one node pk or an iterable of node pks


a list of aiida objects with all the parents of the nodes


Search for bands and return bands and the closest structure that is a parent of the instance. This is the backend independent way, can be overriden for performance reason


A list of sublists, each latter containing (in order):

pk as string, formula as string, creation date, bandsdata-label

static get_creation_statistics(user_pk=None)[source]

Return a dictionary with the statistics of node creation, summarized by day.


Days when no nodes were created are not present in the returned ctime_by_day dictionary.


user_pk – If None (default), return statistics for all users. If user pk is specified, return only the statistics for the given user.


a dictionary as follows:

   "total": TOTAL_NUM_OF_NODES,
   "types": {TYPESTRING1: count, TYPESTRING2: count, ...},
   "ctime_by_day": {'YYYY-MMM-DD': count, ...}

where in ctime_by_day the key is a string in the format ‘YYYY-MM-DD’ and the value is an integer with the number of nodes created that day.


Return a list of rows with identical UUID


table – Database table with uuid column, e.g. ‘db_dbnode’


list of tuples of (id, uuid) of rows with duplicate UUIDs

Rtype list