aiida.backends.general package

Submodules

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

Bases: object

__abstractmethods__ = frozenset({})
__dict__ = mappingproxy({'__module__': 'aiida.backends.general.abstractqueries', '__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': <function AbstractQueryManager.get_creation_statistics>, 'get_bands_and_parents_structure': <function AbstractQueryManager.get_bands_and_parents_structure>, 'get_all_parents': <function AbstractQueryManager.get_all_parents>, '__doc__': None, '__dict__': <attribute '__dict__' of 'AbstractQueryManager' objects>, '__weakref__': <attribute '__weakref__' of 'AbstractQueryManager' objects>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc_data object>})
__init__(backend)[source]
Parameters

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

__module__ = 'aiida.backends.general.abstractqueries'
__weakref__

list of weak references to the object (if defined)

_abc_impl = <_abc_data object>
apply_new_uuid_mapping(table, mapping)[source]
get_all_parents(node_pks, return_values=('id', ))[source]

Get all the parents of given nodes :param node_pks: one node pk or an iterable of node pks :return: a list of aiida objects with all the parents of the nodes

get_bands_and_parents_structure(args)[source]

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

Returns

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

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

get_creation_statistics(user_pk=None)[source]

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

Note

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

Parameters

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

Returns

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.

get_duplicate_uuids(table)[source]

Return a list of rows with identical UUID

Parameters

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

Returns

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

Rtype list