aiida.orm.implementation package

Module with the implementations of the various backend entities for various database backends.

class aiida.orm.implementation.BackendAuthInfo(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Base class for backend authorization information which contains computer configuration specific to a given user (authorization info and other metadata, like how often to check on a given computer etc.)

METADATA_WORKDIR = 'workdir'
__abstractmethods__ = frozenset(['computer', 'enabled', 'is_stored', 'set_metadata', 'user', 'get_metadata', 'get_auth_params', 'id', 'store', 'set_auth_params'])
__module__ = 'aiida.orm.implementation.authinfos'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
computer

The computer that this authinfo relates to

Returns:The corresponding computer
Return type:aiida.orm.Computer
enabled

Is the computer enabled for this user?

Return type:bool
get_auth_params()[source]

Get the dictionary of auth_params

Returns:a dictionary
get_metadata()[source]

Get the metadata dictionary

Returns:a dictionary
get_property(name)[source]
id

Return the ID in the DB.

is_stored

Is it already stored or not?

Returns:Boolean
Return type:bool
pk()[source]

Return the principal key in the DB.

set_auth_params(auth_params)[source]

Set the dictionary of auth_params

Parameters:auth_params – a dictionary with the new auth_params
set_metadata(metadata)[source]

Replace the metadata dictionary in the DB with the provided dictionary

set_property(name, value)[source]
user

The user that this authinfo relates to

Returns:The corresponding user
Return type:aiida.orm.User
class aiida.orm.implementation.BackendAuthInfoCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of AuthInfo entries.

ENTITY_CLASS

alias of BackendAuthInfo

__abstractmethods__ = frozenset(['get', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.authinfos'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332304566
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendAuthInfoCollection

delete(authinfo_id)[source]

Remove an AuthInfo from the collection with the given id :param authinfo_id: The ID of the authinfo to delete

get(computer, user)[source]

Return a AuthInfo given a computer and a user

Parameters:
  • computer – a Computer instance
  • user – a User instance
Returns:

a AuthInfo object associated to the given computer and user

Raises:
  • aiida.common.NotExistent – if the user is not configured to use computer
  • sqlalchemy.orm.exc.MultipleResultsFound – if the user is configured more than once to use the computer! Should never happen
class aiida.orm.implementation.Backend[source]

Bases: object

The public interface that defines a backend factory that creates backend specific concrete objects.

__abstractmethods__ = frozenset(['transaction', 'logs', 'migrate', 'computers', 'query_manager', 'comments', 'authinfos', 'groups', 'query', 'nodes', 'users'])
__dict__ = dict_proxy({'_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 39, '__module__': 'aiida.orm.implementation.backends', 'transaction': <function transaction>, 'logs': <abc.abstractproperty object>, 'migrate': <function migrate>, '_abc_registry': <_weakrefset.WeakSet object>, 'computers': <abc.abstractproperty object>, 'query_manager': <abc.abstractproperty object>, 'comments': <abc.abstractproperty object>, 'authinfos': <abc.abstractproperty object>, 'groups': <abc.abstractproperty object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '__dict__': <attribute '__dict__' of 'Backend' objects>, 'query': <function query>, 'nodes': <abc.abstractproperty object>, '__weakref__': <attribute '__weakref__' of 'Backend' objects>, '__doc__': 'The public interface that defines a backend factory that creates backend specific concrete objects.', '__abstractmethods__': frozenset(['transaction', 'logs', 'migrate', 'computers', 'query_manager', 'comments', 'authinfos', 'groups', 'query', 'nodes', 'users']), 'users': <abc.abstractproperty object>})
__module__ = 'aiida.orm.implementation.backends'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
authinfos

Return the collection of authorisation information objects

Returns:the authinfo collection
Return type:aiida.orm.implementation.BackendAuthInfoCollection
comments

Return the collection of comments

Returns:the comment collection
Return type:aiida.orm.implementation.BackendCommentCollection
computers

Return the collection of computers

Returns:the computers collection
Return type:aiida.orm.implementation.BackendComputerCollection
groups

Return the collection of groups

Returns:the groups collection
Return type:aiida.orm.implementation.BackendGroupCollection
logs

Return the collection of logs

Returns:the log collection
Return type:aiida.orm.implementation.BackendLogCollection
migrate()[source]

Migrate the database to the latest schema version.

nodes

Return the collection of nodes

Returns:the nodes collection
Return type:aiida.orm.implementation.BackendNodeCollection
query()[source]

Return an instance of a query builder implementation for this backend

Returns:a new query builder instance
Return type:aiida.orm.implementation.BackendQueryBuilder
query_manager

Return the query manager for the objects stored in the backend

Returns:The query manger
Return type:aiida.backends.general.abstractqueries.AbstractQueryManager
transaction()[source]

Get a context manager that can be used as a transaction context for a series of backend operations. If there is an exception within the context then the changes will be rolled back and the state will be as before entering. Transactions can be nested.

Returns:a context manager to group database operations
users

Return the collection of users

Returns:the users collection
Return type:aiida.orm.implementation.BackendUserCollection
class aiida.orm.implementation.BackendEntity(backend)[source]

Bases: object

An first-class entity in the backend

__abstractmethods__ = frozenset(['is_stored', 'id', 'store'])
__dict__ = dict_proxy({'_abc_cache': <_weakrefset.WeakSet object>, '__module__': 'aiida.orm.implementation.backends', '_abc_registry': <_weakrefset.WeakSet object>, '__abstractmethods__': frozenset(['is_stored', 'id', 'store']), 'id': <abc.abstractproperty object>, 'is_stored': <abc.abstractproperty object>, '_abc_negative_cache_version': 39, '__init__': <function __init__>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '__dict__': <attribute '__dict__' of 'BackendEntity' objects>, 'pk': <property object>, 'dbmodel': <property object>, '__weakref__': <attribute '__weakref__' of 'BackendEntity' objects>, '__doc__': 'An first-class entity in the backend', 'store': <function store>, 'backend': <property object>})
__init__(backend)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__module__ = 'aiida.orm.implementation.backends'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
backend

Return the backend this entity belongs to

Returns:the backend instance
dbmodel
id

Return the id for this entity.

This is unique only amongst entities of this type for a particular backend.

Returns:the entity id
is_stored

Return whether the entity is stored.

Returns:True if stored, False otherwise
Return type:bool
pk

Return the id for this entity.

This is unique only amongst entities of this type for a particular backend.

Returns:the entity id
store()[source]

Store this entity in the backend.

Whether it is possible to call store more than once is delegated to the object itself

class aiida.orm.implementation.BackendCollection(backend)[source]

Bases: typing.Generic

Container class that represents a collection of entries of a particular backend entity.

ENTITY_CLASS = None
__abstractmethods__ = frozenset([])
__args__ = None
__dict__ = dict_proxy({'ENTITY_CLASS': None, '__module__': 'aiida.orm.implementation.backends', 'from_dbmodel': <function from_dbmodel>, u'__origin__': None, '__dict__': <attribute '__dict__' of 'BackendCollection' objects>, '__weakref__': <attribute '__weakref__' of 'BackendCollection' objects>, '__init__': <function __init__>, 'backend': <property object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_generic_negative_cache_version': 39, 'create': <function create>, '__abstractmethods__': frozenset([]), '__orig_bases__': (typing.Generic[~EntityType],), '__doc__': 'Container class that represents a collection of entries of a particular backend entity.', '__tree_hash__': 5926332322856, '__args__': None, '__parameters__': (~EntityType,), '_gorg': aiida.orm.implementation.backends.BackendCollection, '__next_in_mro__': <type 'object'>, u'__extra__': None, '_abc_registry': <_weakrefset.WeakSet object>, '_abc_generic_negative_cache': <_weakrefset.WeakSet object>})
__extra__ = None
__init__(backend)[source]
Parameters:backend (aiida.orm.implementation.Backend) – the backend this collection belongs to
__module__ = 'aiida.orm.implementation.backends'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (typing.Generic[~EntityType],)
__origin__ = None
__parameters__ = (~EntityType,)
__tree_hash__ = 5926332322856
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendCollection

backend

Return the backend.

Return type:aiida.orm.implementation.Backend
create(**kwargs)[source]

Create new a entry and set the attributes to those specified in the keyword arguments

Returns:the newly created entry of type ENTITY_CLASS
from_dbmodel(dbmodel)[source]

Create an entity from the backend dbmodel

Parameters:dbmodel – the dbmodel to create the entity from
Returns:the entity instance
class aiida.orm.implementation.BackendComment(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Base class for a node comment.

__abstractmethods__ = frozenset(['node', 'set_content', 'set_mtime', 'content', 'is_stored', 'user', 'set_user', 'mtime', 'id', 'store', 'ctime'])
__module__ = 'aiida.orm.implementation.comments'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
content
ctime
mtime
node
set_content(value)[source]
set_mtime(value)[source]
set_user(value)[source]
user
uuid
class aiida.orm.implementation.BackendCommentCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Comment entries.

ENTITY_CLASS

alias of BackendComment

__abstractmethods__ = frozenset(['create', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.comments'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332320988
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendCommentCollection

create(node, user, content=None, **kwargs)[source]

Create a Comment for a given node and user

Parameters:
  • node – a Node instance
  • user – a User instance
  • content – the comment content
Returns:

a Comment object associated to the given node and user

delete(comment)[source]

Remove a Comment from the collection with the given id

Parameters:comment – the id of the comment to delete
class aiida.orm.implementation.BackendComputer(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Base class to map a node in the DB + its permanent repository counterpart.

Stores attributes starting with an underscore.

Caches files and attributes before the first save, and saves everything only on store(). After the call to store(), attributes cannot be changed.

Only after storing (or upon loading from uuid) metadata can be modified and in this case they are directly set on the db.

In the plugin, also set the _plugin_type_string, to be set in the DB in the ‘type’ field.

__abstractmethods__ = frozenset(['is_enabled', 'get_transport_type', 'set_description', 'set_enabled_state', 'get_transport_params', 'set_transport_type', 'get_description', 'is_stored', 'set_scheduler_type', 'get_metadata', 'set_transport_params', 'id', 'description', 'set_name', 'name', 'get_scheduler_type', 'get_name', 'set_hostname', 'set_metadata', 'hostname', 'store'])
__module__ = 'aiida.orm.implementation.computers'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_logger = <logging.Logger object>
description
get_description()[source]
get_hostname()[source]

Get this computer hostname :rtype: str

get_metadata()[source]
get_name()[source]
get_scheduler_type()[source]
get_transport_params()[source]
get_transport_type()[source]
hostname
is_enabled()[source]
is_stored

Is the computer stored?

Returns:True if stored, False otherwise
Return type:bool
name
set_description(val)[source]
set_enabled_state(enabled)[source]
set_hostname(val)[source]

Set the hostname of this computer :param val: The new hostname :type val: str

set_metadata(metadata_dict)[source]

Set the metadata.

set_name(val)[source]
set_scheduler_type(scheduler_type)[source]
set_transport_params(val)[source]
set_transport_type(transport_type)[source]
class aiida.orm.implementation.BackendComputerCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Computer entries.

ENTITY_CLASS

alias of BackendComputer

__abstractmethods__ = frozenset(['delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.computers'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332328322
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendComputerCollection

delete(pk)[source]

Delete an entry with the given pk

Parameters:pk – the pk of the entry to delete
class aiida.orm.implementation.BackendGroup(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

An AiiDA ORM implementation of group of nodes.

__abstractmethods__ = frozenset(['__int__', 'count', 'type_string', 'description', 'label', 'is_stored', 'user', 'nodes', 'id', 'store', 'uuid'])
__int__()[source]

Convert the class to an integer. This is needed to allow querying with Django. Be careful, though, not to pass it to a wrong field! This only returns the local DB principal key (pk) value.

Returns:the integer pk of the node or None if not stored.
__module__ = 'aiida.orm.implementation.groups'
__repr__() <==> repr(x)[source]
__str__() <==> str(x)[source]
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
add_nodes(nodes, **kwargs)[source]

Add a set of nodes to the group.

Note:all the nodes and the group itself have to be stored.
Parameters:nodes – a list of BackendNode instances to be added to this group
count

Return the number of entities in this group.

Returns:integer number of entities contained within the group
classmethod create(*args, **kwargs)[source]

Create and store a new group.

Note: This method does not check for presence of the group. You may want to use get_or_create().

Returns:group
description
Returns:the description of the group as a string
classmethod get_or_create(*args, **kwargs)[source]

Try to retrieve a group from the DB with the given arguments; create (and store) a new group if such a group was not present yet.

Returns:(group, created) where group is the group (new or existing, in any case already stored) and created is a boolean saying
id
Returns:the principal key (the ID) as an integer, or None if the node was not stored yet
is_stored
Returns:True if the respective DbNode has been already saved in the DB, False otherwise
label
Returns:the name of the group as a string
nodes

Return a generator/iterator that iterates over all nodes and returns the respective AiiDA subclasses of Node, and also allows to ask for the number of nodes in the group using len().

remove_nodes(nodes)[source]

Remove a set of nodes from the group.

Note:all the nodes and the group itself have to be stored.
Parameters:nodes – a list of BackendNode instances to be removed from this group
store()[source]

Store this entity in the backend.

Whether it is possible to call store more than once is delegated to the object itself

type_string
Returns:the string defining the type of the group
user
Returns:a backend user object, representing the user associated to this group.
Return type:aiida.orm.implementation.BackendUser
uuid
Returns:a string with the uuid
class aiida.orm.implementation.BackendGroupCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Group entries.

ENTITY_CLASS

alias of BackendGroup

__abstractmethods__ = frozenset(['query', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.groups'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332330475
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendGroupCollection

delete(id)[source]

Delete a group with the given id

Parameters:id – the id of the group to delete
get(**filters)[source]

Get the group matching the given filters

Parameters:filters – the attributes of the group to get
Returns:the group
Return type:aiida.orm.implementation.BackendGroup
query(label=None, type_string=None, pk=None, uuid=None, nodes=None, user=None, node_attributes=None, past_days=None, label_filters=None, **kwargs)[source]

Query for groups.

Note:

By default, query for user-defined groups only (type_string==”“). If you want to query for all type of groups, pass type_string=None. If you want to query for a specific type of groups, pass a specific string as the type_string argument.

Parameters:
  • name – the name of the group
  • nodes – a node or list of nodes that belongs to the group (alternatively, you can also pass a DbNode or list of DbNodes)
  • pk – the pk of the group
  • uuid – the uuid of the group
  • type_string – the string for the type of node; by default, look only for user-defined groups (see note above).
  • user – by default, query for groups of all users; if specified, must be a DbUser object, or a string for the user email.
  • past_days – by default, query for all groups; if specified, query the groups created in the last past_days. Must be a datetime object.
  • name_filters – dictionary that can contain ‘startswith’, ‘endswith’ or ‘contains’ as keys
  • node_attributes – if not None, must be a dictionary with format {k: v}. It will filter and return only groups where there is at least a node with an attribute with key=k and value=v. Different keys of the dictionary are joined with AND (that is, the group should satisfy all requirements. v can be a base data type (str, bool, int, float, …) If it is a list or iterable, that the condition is checked so that there should be at least a node in the group with key=k and value=each of the values of the iterable.
  • kwargs

    any other filter to be passed to DbGroup.objects.filter

    Example: if node_attributes = {'elements': ['Ba', 'Ti'], 'md5sum': 'xxx'},
    it will find groups that contain the node with md5sum = ‘xxx’, and moreover contain at least one node for element ‘Ba’ and one node for element ‘Ti’.
class aiida.orm.implementation.BackendLog(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Backend Log interface

__abstractmethods__ = frozenset(['uuid', 'dbnode_id', 'loggername', 'is_stored', 'levelname', 'time', 'message', 'id', 'store', 'metadata'])
__module__ = 'aiida.orm.implementation.logs'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
dbnode_id

Get the id of the object that created the log entry

Returns:The id of the object that created the log entry
Return type:int
levelname

The name of the log level

Returns:The entry log level name
Return type:basestring
loggername

The name of the logger that created this entry

Returns:The entry loggername
Return type:basestring
message

Get the message corresponding to the entry

Returns:The entry message
Return type:basestring
metadata

Get the metadata corresponding to the entry

Returns:The entry metadata
Return type:json.json
time

Get the time corresponding to the entry

Returns:The entry timestamp
Return type:datetime.datetime
uuid

Get the UUID of the log entry

Returns:The entry’s UUID
Return type:uuid.UUID
class aiida.orm.implementation.BackendLogCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Log entries.

ENTITY_CLASS

alias of BackendLog

__abstractmethods__ = frozenset(['delete_many', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.logs'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332328669
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendLogCollection

delete(log_id)[source]

Remove a Log entry from the collection with the given id

Parameters:log_id – id of the log to delete
delete_many(filters)[source]

Delete multiple log entries in the table

class aiida.orm.implementation.BackendNode(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Wrapper around a DbNode instance to set and retrieve data independent of the database implementation.

__abstractmethods__ = frozenset(['delete_attribute', 'attributes_keys', 'extras_keys', 'add_incoming', 'set_attributes', 'get_attribute', 'get_extra', '_increment_version_number', 'delete_extra', 'computer', 'user', 'attributes_items', 'id', 'delete_attributes', 'reset_attributes', 'extras_items', 'clear_attributes', 'delete_extras', 'set_extras', 'reset_extras', 'get_extras', 'set_extra', 'set_attribute', 'is_stored', 'get_attributes', 'clear_extras', 'clone', 'store'])
__module__ = 'aiida.orm.implementation.nodes'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_increment_version_number()[source]

Increment the node version number of this node by one directly in the database.

add_incoming(source, link_type, link_label)[source]

Add a link of the given type from a given node to ourself.

Parameters:
  • source – the node from which the link is coming
  • link_type – the link type
  • link_label – the link label
Returns:

True if the proposed link is allowed, False otherwise

Raises:
  • TypeError – if source is not a Node instance or link_type is not a LinkType enum
  • ValueError – if the proposed link is invalid
attributes

Return the attributes dictionary.

Note

This will fetch all the attributes from the database which can be a heavy operation. If you only need the keys or some values, use the iterators attributes_keys and attributes_items, or the getters get_attribute and get_attributes instead.

Returns:the attributes as a dictionary
attributes_items()[source]

Return an iterator over the attribute items.

Returns:an iterator with attribute key value pairs
attributes_keys()[source]

Return an iterator over the attribute keys.

Returns:an iterator with attribute keys
clear_attributes()[source]

Delete all attributes.

clear_extras()[source]

Delete all extras.

clone()[source]

Return an unstored clone of ourselves.

Returns:an unstored BackendNode with the exact same attributes and extras as self
computer

Return the computer of this node.

Returns:the computer or None
Return type:BackendComputer or None
ctime

Return the node ctime.

Returns:the ctime
delete_attribute(key)[source]

Delete an attribute.

Parameters:key – name of the attribute
Raises:AttributeError – if the attribute does not exist
delete_attributes(keys)[source]

Delete multiple attributes.

Note

The implementation should guarantee that all the keys that are to be deleted actually exist or the entire operation should be canceled without any change and an AttributeError should be raised.

Parameters:keys – names of the attributes to delete
Raises:AttributeError – if at least on of the attribute does not exist
delete_extra(key)[source]

Delete an extra.

Parameters:key – name of the extra
Raises:AttributeError – if the extra does not exist
delete_extras(keys)[source]

Delete multiple extras.

Note

The implementation should guarantee that all the keys that are to be deleted actually exist or the entire operation should be canceled without any change and an AttributeError should be raised.

Parameters:keys – names of the extras to delete
Raises:AttributeError – if at least on of the extra does not exist
description

Return the node description.

Returns:the description
extras

Return the extras dictionary.

Note

This will fetch all the extras from the database which can be a heavy operation. If you only need the keys or some values, use the iterators extras_keys and extras_items, or the getters get_extra and get_extras instead.

Returns:the extras as a dictionary
extras_items()[source]

Return an iterator over the extra items.

Returns:an iterator with extra key value pairs
extras_keys()[source]

Return an iterator over the attribute keys.

Returns:an iterator with attribute keys
get_attribute(key)[source]

Return an attribute.

Parameters:key – name of the attribute
Returns:the value of the attribute
Raises:AttributeError – if the attribute does not exist
get_attributes(keys)[source]

Return a set of attributes.

Parameters:keys – names of the attributes
Returns:the values of the attributes
Raises:AttributeError – if at least one attribute does not exist
get_extra(key)[source]

Return an extra.

Parameters:key – name of the extra
Returns:the value of the extra
Raises:AttributeError – if the extra does not exist
get_extras(keys)[source]

Return a set of extras.

Parameters:keys – names of the extras
Returns:the values of the extras
Raises:AttributeError – if at least one extra does not exist
label

Return the node label.

Returns:the label
mtime

Return the node mtime.

Returns:the mtime
node_type

Return the node type.

Returns:the node type
process_type

Return the node process type.

Returns:the process type
public

Return the node public attribute.

Returns:the public attribute
reset_attributes(attributes)[source]

Reset the attributes.

Note

This will completely reset any existing attributes and replace them with the new dictionary.

Parameters:attributes – the new attributes to set
reset_extras(extras)[source]

Reset the extras.

Note

This will completely reset any existing extras and replace them with the new dictionary.

Parameters:extras – the new extras to set
set_attribute(key, value)[source]

Set an attribute to the given value.

Parameters:
  • key – name of the attribute
  • value – value of the attribute
set_attributes(attributes)[source]

Set attributes.

Note

This will override any existing attributes that are present in the new dictionary.

Parameters:attributes – the new attributes to set
set_extra(key, value, increase_version=True)[source]

Set an extra to the given value.

Parameters:
  • key – name of the extra
  • value – value of the extra
  • increase_version – boolean, if True will increase the node version upon successfully setting the extra
set_extras(extras)[source]

Set extras.

Note

This will override any existing extras that are present in the new dictionary.

Parameters:extras – the new extras to set
store(attributes=None, links=None, with_transaction=True)[source]

Store the node in the database.

Parameters:
  • attributes – optional attributes to set before storing, will override any existing attributes
  • links – optional links to add before storing
  • with_transaction – if False, do not use a transaction because the caller will already have opened one.
user

Return the user of this node.

Returns:the user
Return type:BackendUser
uuid

Return the node UUID.

Returns:the string representation of the UUID
Return type:str or None
version

Return the node version.

Returns:the version
class aiida.orm.implementation.BackendNodeCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of BackendNode entries.

ENTITY_CLASS

alias of BackendNode

__abstractmethods__ = frozenset(['delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.nodes'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332327935
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendNodeCollection

delete(pk)[source]

Remove a Node entry from the collection with the given id

Parameters:pk – id of the node to delete
class aiida.orm.implementation.BackendQueryBuilder(backend)[source]

Bases: object

Backend query builder interface

AiidaNode

A property, decorated with @property. Returns the implementation for the AiiDA-class for Node

AuthInfo()[source]

A property, decorated with @property. Returns the implementation for the Group

Comment()[source]

A property, decorated with @property. Returns the implementation for the Comment

Computer()[source]

A property, decorated with @property. Returns the implementation for the Computer

Group()[source]

A property, decorated with @property. Returns the implementation for the Group

A property, decorated with @property. Returns the implementation for the DbLink

Log()[source]

A property, decorated with @property. Returns the implementation for the Log

Node()[source]

Decorated as a property, returns the implementation for DbNode. It needs to return a subclass of sqlalchemy.Base, which means that for different ORM’s a corresponding dummy-model must be written.

User()[source]

A property, decorated with @property. Returns the implementation for the User

__abstractmethods__ = frozenset(['Node', 'get_session', 'Group', 'Log', 'get_projectable_attribute', 'Comment', 'get_aiida_res', 'modify_expansions', 'table_groups_nodes', 'yield_per', 'get_filter_expr_from_attributes', 'count', 'AuthInfo', 'Computer', 'Link', 'User', 'iterall', 'iterdict', 'first'])
__dict__ = dict_proxy({'Node': <function Node>, '__module__': 'aiida.orm.implementation.querybuilder', '__abstractmethods__': frozenset(['Node', 'get_session', 'Group', 'Log', 'get_projectable_attribute', 'Comment', 'get_aiida_res', 'modify_expansions', 'table_groups_nodes', 'yield_per', 'get_filter_expr_from_attributes', 'count', 'AuthInfo', 'Computer', 'Link', 'User', 'iterall', 'iterdict', 'first']), 'Group': <function Group>, 'Log': <function Log>, '_abc_negative_cache': <_weakrefset.WeakSet object>, 'get_column': <function get_column>, 'get_filter_expr_from_column': <classmethod object>, 'get_projectable_attribute': <function get_projectable_attribute>, '__dict__': <attribute '__dict__' of 'BackendQueryBuilder' objects>, 'get_session': <function get_session>, '__init__': <function __init__>, 'Comment': <function Comment>, 'get_aiida_res': <function get_aiida_res>, 'modify_expansions': <function modify_expansions>, 'table_groups_nodes': <function table_groups_nodes>, '__weakref__': <attribute '__weakref__' of 'BackendQueryBuilder' objects>, 'yield_per': <function yield_per>, 'get_filter_expr_from_attributes': <aiida.common.lang.abstractclassmethod object>, 'count': <function count>, 'AiidaNode': <property object>, '_abc_cache': <_weakrefset.WeakSet object>, 'AuthInfo': <function AuthInfo>, 'Computer': <function Computer>, 'Link': <function Link>, 'User': <function User>, 'iterall': <function iterall>, '_abc_negative_cache_version': 39, '_abc_registry': <_weakrefset.WeakSet object>, '__doc__': 'Backend query builder interface', 'iterdict': <function iterdict>, 'first': <function first>})
__init__(backend)[source]
Parameters:backend – the backend
__module__ = 'aiida.orm.implementation.querybuilder'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
count(query)[source]
Returns:the number of results
first(query)[source]

Executes query in the backend asking for one instance.

Returns:One row of aiida results
get_aiida_res(key, res)[source]

Some instance returned by ORM (django or SA) need to be converted to Aiida instances (eg nodes)

Parameters:
  • key – the key that this entry would be returned with
  • res – the result returned by the query
Returns:

an aiida-compatible instance

get_column(colname, alias)[source]

Return the column for a given projection.

classmethod get_filter_expr_from_attributes(operator, value, attr_key, column=None, column_name=None, alias=None)[source]

Returns an valid SQLAlchemy expression.

Parameters:
  • operator – The operator provided by the user (‘==’, ‘>’, …)
  • value – The value to compare with, e.g. (5.0, ‘foo’, [‘a’,’b’])
  • attr_key (str) – The path to that attribute as a tuple of values. I.e. if that attribute I want to filter by is the 2nd element in a list stored under the key ‘mylist’, this is (‘mylist’, ‘2’).
  • column – Optional, an instance of sqlalchemy.orm.attributes.InstrumentedAttribute or
  • column_name (str) – The name of the column, and the backend should get the InstrumentedAttribute.
  • alias – The aliased class.
Returns:

An instance of sqlalchemy.sql.elements.BinaryExpression

classmethod get_filter_expr_from_column(operator, value, column)[source]

A method that returns an valid SQLAlchemy expression.

Parameters:
  • operator – The operator provided by the user (‘==’, ‘>’, …)
  • value – The value to compare with, e.g. (5.0, ‘foo’, [‘a’,’b’])
  • column – an instance of sqlalchemy.orm.attributes.InstrumentedAttribute or
Returns:

An instance of sqlalchemy.sql.elements.BinaryExpression

get_projectable_attribute(alias, column_name, attrpath, cast=None, **kwargs)[source]
get_session()[source]
Returns:a valid session, an instance of sqlalchemy.orm.session.Session
iterall(query, batch_size, tag_to_index_dict)[source]
Returns:An iterator over all the results of a list of lists.
iterdict(query, batch_size, tag_to_projected_entity_dict)[source]
Returns:An iterator over all the results of a list of dictionaries.
modify_expansions(alias, expansions)[source]

Modify names of projections if ** was specified. This is important for the schema having attributes in a different table.

table_groups_nodes()[source]

A property, decorated with @property. Returns the implementation for the many-to-many relationship between group and nodes.

yield_per(query, batch_size)[source]
Parameters:batch_size (int) – Number of rows to yield per step

Yields count rows at a time

Returns:a generator
class aiida.orm.implementation.BackendUser(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

This is the base class for User information in AiiDA. An implementing backend needs to provide a concrete version.

REQUIRED_FIELDS = ['first_name', 'last_name', 'institution']
__abstractmethods__ = frozenset(['first_name', 'last_name', 'institution', 'is_active', 'id', 'get_password', 'is_stored', 'last_login', 'set_password', 'email', 'store', 'date_joined'])
__module__ = 'aiida.orm.implementation.users'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
date_joined
email

Get the email address of the user

Returns:the email address
first_name

Get the user’s first name

Returns:the first name
Return type:str
get_password()[source]

Get the password for the user

Returns:the password
institution

Get the user’s institution

Returns:the institution
Return type:str
is_active
last_login
last_name

Get the user’s last name

Returns:the last name
Return type:str
set_password(new_pass)[source]

Set the password of the user

Parameters:new_pass – the new password
uuid

For now users do not have UUIDs so always return false

Returns:None
class aiida.orm.implementation.BackendUserCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

ENTITY_CLASS

alias of BackendUser

__abstractmethods__ = frozenset([])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.users'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection[aiida.orm.implementation.users.BackendUser],)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332329443
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendUserCollection

Submodules

Module for authinfo backend classes.

class aiida.orm.implementation.authinfos.BackendAuthInfo(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Base class for backend authorization information which contains computer configuration specific to a given user (authorization info and other metadata, like how often to check on a given computer etc.)

METADATA_WORKDIR = 'workdir'
__abstractmethods__ = frozenset(['computer', 'enabled', 'is_stored', 'set_metadata', 'user', 'get_metadata', 'get_auth_params', 'id', 'store', 'set_auth_params'])
__module__ = 'aiida.orm.implementation.authinfos'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
computer

The computer that this authinfo relates to

Returns:The corresponding computer
Return type:aiida.orm.Computer
enabled

Is the computer enabled for this user?

Return type:bool
get_auth_params()[source]

Get the dictionary of auth_params

Returns:a dictionary
get_metadata()[source]

Get the metadata dictionary

Returns:a dictionary
get_property(name)[source]
id

Return the ID in the DB.

is_stored

Is it already stored or not?

Returns:Boolean
Return type:bool
pk()[source]

Return the principal key in the DB.

set_auth_params(auth_params)[source]

Set the dictionary of auth_params

Parameters:auth_params – a dictionary with the new auth_params
set_metadata(metadata)[source]

Replace the metadata dictionary in the DB with the provided dictionary

set_property(name, value)[source]
user

The user that this authinfo relates to

Returns:The corresponding user
Return type:aiida.orm.User
class aiida.orm.implementation.authinfos.BackendAuthInfoCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of AuthInfo entries.

ENTITY_CLASS

alias of BackendAuthInfo

__abstractmethods__ = frozenset(['get', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.authinfos'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332304566
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendAuthInfoCollection

delete(authinfo_id)[source]

Remove an AuthInfo from the collection with the given id :param authinfo_id: The ID of the authinfo to delete

get(computer, user)[source]

Return a AuthInfo given a computer and a user

Parameters:
  • computer – a Computer instance
  • user – a User instance
Returns:

a AuthInfo object associated to the given computer and user

Raises:
  • aiida.common.NotExistent – if the user is not configured to use computer
  • sqlalchemy.orm.exc.MultipleResultsFound – if the user is configured more than once to use the computer! Should never happen

Generic backend related objects

class aiida.orm.implementation.backends.Backend[source]

Bases: object

The public interface that defines a backend factory that creates backend specific concrete objects.

__abstractmethods__ = frozenset(['transaction', 'logs', 'migrate', 'computers', 'query_manager', 'comments', 'authinfos', 'groups', 'query', 'nodes', 'users'])
__dict__ = dict_proxy({'_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 39, '__module__': 'aiida.orm.implementation.backends', 'transaction': <function transaction>, 'logs': <abc.abstractproperty object>, 'migrate': <function migrate>, '_abc_registry': <_weakrefset.WeakSet object>, 'computers': <abc.abstractproperty object>, 'query_manager': <abc.abstractproperty object>, 'comments': <abc.abstractproperty object>, 'authinfos': <abc.abstractproperty object>, 'groups': <abc.abstractproperty object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '__dict__': <attribute '__dict__' of 'Backend' objects>, 'query': <function query>, 'nodes': <abc.abstractproperty object>, '__weakref__': <attribute '__weakref__' of 'Backend' objects>, '__doc__': 'The public interface that defines a backend factory that creates backend specific concrete objects.', '__abstractmethods__': frozenset(['transaction', 'logs', 'migrate', 'computers', 'query_manager', 'comments', 'authinfos', 'groups', 'query', 'nodes', 'users']), 'users': <abc.abstractproperty object>})
__module__ = 'aiida.orm.implementation.backends'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
authinfos

Return the collection of authorisation information objects

Returns:the authinfo collection
Return type:aiida.orm.implementation.BackendAuthInfoCollection
comments

Return the collection of comments

Returns:the comment collection
Return type:aiida.orm.implementation.BackendCommentCollection
computers

Return the collection of computers

Returns:the computers collection
Return type:aiida.orm.implementation.BackendComputerCollection
groups

Return the collection of groups

Returns:the groups collection
Return type:aiida.orm.implementation.BackendGroupCollection
logs

Return the collection of logs

Returns:the log collection
Return type:aiida.orm.implementation.BackendLogCollection
migrate()[source]

Migrate the database to the latest schema version.

nodes

Return the collection of nodes

Returns:the nodes collection
Return type:aiida.orm.implementation.BackendNodeCollection
query()[source]

Return an instance of a query builder implementation for this backend

Returns:a new query builder instance
Return type:aiida.orm.implementation.BackendQueryBuilder
query_manager

Return the query manager for the objects stored in the backend

Returns:The query manger
Return type:aiida.backends.general.abstractqueries.AbstractQueryManager
transaction()[source]

Get a context manager that can be used as a transaction context for a series of backend operations. If there is an exception within the context then the changes will be rolled back and the state will be as before entering. Transactions can be nested.

Returns:a context manager to group database operations
users

Return the collection of users

Returns:the users collection
Return type:aiida.orm.implementation.BackendUserCollection
class aiida.orm.implementation.backends.BackendEntity(backend)[source]

Bases: object

An first-class entity in the backend

__abstractmethods__ = frozenset(['is_stored', 'id', 'store'])
__dict__ = dict_proxy({'_abc_cache': <_weakrefset.WeakSet object>, '__module__': 'aiida.orm.implementation.backends', '_abc_registry': <_weakrefset.WeakSet object>, '__abstractmethods__': frozenset(['is_stored', 'id', 'store']), 'id': <abc.abstractproperty object>, 'is_stored': <abc.abstractproperty object>, '_abc_negative_cache_version': 39, '__init__': <function __init__>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '__dict__': <attribute '__dict__' of 'BackendEntity' objects>, 'pk': <property object>, 'dbmodel': <property object>, '__weakref__': <attribute '__weakref__' of 'BackendEntity' objects>, '__doc__': 'An first-class entity in the backend', 'store': <function store>, 'backend': <property object>})
__init__(backend)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__module__ = 'aiida.orm.implementation.backends'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
backend

Return the backend this entity belongs to

Returns:the backend instance
dbmodel
id

Return the id for this entity.

This is unique only amongst entities of this type for a particular backend.

Returns:the entity id
is_stored

Return whether the entity is stored.

Returns:True if stored, False otherwise
Return type:bool
pk

Return the id for this entity.

This is unique only amongst entities of this type for a particular backend.

Returns:the entity id
store()[source]

Store this entity in the backend.

Whether it is possible to call store more than once is delegated to the object itself

class aiida.orm.implementation.backends.BackendCollection(backend)[source]

Bases: typing.Generic

Container class that represents a collection of entries of a particular backend entity.

ENTITY_CLASS = None
__abstractmethods__ = frozenset([])
__args__ = None
__dict__ = dict_proxy({'ENTITY_CLASS': None, '__module__': 'aiida.orm.implementation.backends', 'from_dbmodel': <function from_dbmodel>, u'__origin__': None, '__dict__': <attribute '__dict__' of 'BackendCollection' objects>, '__weakref__': <attribute '__weakref__' of 'BackendCollection' objects>, '__init__': <function __init__>, 'backend': <property object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_generic_negative_cache_version': 39, 'create': <function create>, '__abstractmethods__': frozenset([]), '__orig_bases__': (typing.Generic[~EntityType],), '__doc__': 'Container class that represents a collection of entries of a particular backend entity.', '__tree_hash__': 5926332322856, '__args__': None, '__parameters__': (~EntityType,), '_gorg': aiida.orm.implementation.backends.BackendCollection, '__next_in_mro__': <type 'object'>, u'__extra__': None, '_abc_registry': <_weakrefset.WeakSet object>, '_abc_generic_negative_cache': <_weakrefset.WeakSet object>})
__extra__ = None
__init__(backend)[source]
Parameters:backend (aiida.orm.implementation.Backend) – the backend this collection belongs to
__module__ = 'aiida.orm.implementation.backends'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (typing.Generic[~EntityType],)
__origin__ = None
__parameters__ = (~EntityType,)
__tree_hash__ = 5926332322856
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendCollection

backend

Return the backend.

Return type:aiida.orm.implementation.Backend
create(**kwargs)[source]

Create new a entry and set the attributes to those specified in the keyword arguments

Returns:the newly created entry of type ENTITY_CLASS
from_dbmodel(dbmodel)[source]

Create an entity from the backend dbmodel

Parameters:dbmodel – the dbmodel to create the entity from
Returns:the entity instance

Module for comment backend classes.

class aiida.orm.implementation.comments.BackendComment(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Base class for a node comment.

__abstractmethods__ = frozenset(['node', 'set_content', 'set_mtime', 'content', 'is_stored', 'user', 'set_user', 'mtime', 'id', 'store', 'ctime'])
__module__ = 'aiida.orm.implementation.comments'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
content
ctime
mtime
node
set_content(value)[source]
set_mtime(value)[source]
set_user(value)[source]
user
uuid
class aiida.orm.implementation.comments.BackendCommentCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Comment entries.

ENTITY_CLASS

alias of BackendComment

__abstractmethods__ = frozenset(['create', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.comments'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332320988
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendCommentCollection

create(node, user, content=None, **kwargs)[source]

Create a Comment for a given node and user

Parameters:
  • node – a Node instance
  • user – a User instance
  • content – the comment content
Returns:

a Comment object associated to the given node and user

delete(comment)[source]

Remove a Comment from the collection with the given id

Parameters:comment – the id of the comment to delete

Backend specific computer objects and methods

class aiida.orm.implementation.computers.BackendComputer(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Base class to map a node in the DB + its permanent repository counterpart.

Stores attributes starting with an underscore.

Caches files and attributes before the first save, and saves everything only on store(). After the call to store(), attributes cannot be changed.

Only after storing (or upon loading from uuid) metadata can be modified and in this case they are directly set on the db.

In the plugin, also set the _plugin_type_string, to be set in the DB in the ‘type’ field.

__abstractmethods__ = frozenset(['is_enabled', 'get_transport_type', 'set_description', 'set_enabled_state', 'get_transport_params', 'set_transport_type', 'get_description', 'is_stored', 'set_scheduler_type', 'get_metadata', 'set_transport_params', 'id', 'description', 'set_name', 'name', 'get_scheduler_type', 'get_name', 'set_hostname', 'set_metadata', 'hostname', 'store'])
__module__ = 'aiida.orm.implementation.computers'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_logger = <logging.Logger object>
description
get_description()[source]
get_hostname()[source]

Get this computer hostname :rtype: str

get_metadata()[source]
get_name()[source]
get_scheduler_type()[source]
get_transport_params()[source]
get_transport_type()[source]
hostname
is_enabled()[source]
is_stored

Is the computer stored?

Returns:True if stored, False otherwise
Return type:bool
name
set_description(val)[source]
set_enabled_state(enabled)[source]
set_hostname(val)[source]

Set the hostname of this computer :param val: The new hostname :type val: str

set_metadata(metadata_dict)[source]

Set the metadata.

set_name(val)[source]
set_scheduler_type(scheduler_type)[source]
set_transport_params(val)[source]
set_transport_type(transport_type)[source]
class aiida.orm.implementation.computers.BackendComputerCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Computer entries.

ENTITY_CLASS

alias of BackendComputer

__abstractmethods__ = frozenset(['delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.computers'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332328322
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendComputerCollection

delete(pk)[source]

Delete an entry with the given pk

Parameters:pk – the pk of the entry to delete

Backend group module

class aiida.orm.implementation.groups.BackendGroup(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

An AiiDA ORM implementation of group of nodes.

__abstractmethods__ = frozenset(['__int__', 'count', 'type_string', 'description', 'label', 'is_stored', 'user', 'nodes', 'id', 'store', 'uuid'])
__int__()[source]

Convert the class to an integer. This is needed to allow querying with Django. Be careful, though, not to pass it to a wrong field! This only returns the local DB principal key (pk) value.

Returns:the integer pk of the node or None if not stored.
__module__ = 'aiida.orm.implementation.groups'
__repr__() <==> repr(x)[source]
__str__() <==> str(x)[source]
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
add_nodes(nodes, **kwargs)[source]

Add a set of nodes to the group.

Note:all the nodes and the group itself have to be stored.
Parameters:nodes – a list of BackendNode instances to be added to this group
count

Return the number of entities in this group.

Returns:integer number of entities contained within the group
classmethod create(*args, **kwargs)[source]

Create and store a new group.

Note: This method does not check for presence of the group. You may want to use get_or_create().

Returns:group
description
Returns:the description of the group as a string
classmethod get_or_create(*args, **kwargs)[source]

Try to retrieve a group from the DB with the given arguments; create (and store) a new group if such a group was not present yet.

Returns:(group, created) where group is the group (new or existing, in any case already stored) and created is a boolean saying
id
Returns:the principal key (the ID) as an integer, or None if the node was not stored yet
is_stored
Returns:True if the respective DbNode has been already saved in the DB, False otherwise
label
Returns:the name of the group as a string
nodes

Return a generator/iterator that iterates over all nodes and returns the respective AiiDA subclasses of Node, and also allows to ask for the number of nodes in the group using len().

remove_nodes(nodes)[source]

Remove a set of nodes from the group.

Note:all the nodes and the group itself have to be stored.
Parameters:nodes – a list of BackendNode instances to be removed from this group
store()[source]

Store this entity in the backend.

Whether it is possible to call store more than once is delegated to the object itself

type_string
Returns:the string defining the type of the group
user
Returns:a backend user object, representing the user associated to this group.
Return type:aiida.orm.implementation.BackendUser
uuid
Returns:a string with the uuid
class aiida.orm.implementation.groups.BackendGroupCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Group entries.

ENTITY_CLASS

alias of BackendGroup

__abstractmethods__ = frozenset(['query', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.groups'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332330475
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendGroupCollection

delete(id)[source]

Delete a group with the given id

Parameters:id – the id of the group to delete
get(**filters)[source]

Get the group matching the given filters

Parameters:filters – the attributes of the group to get
Returns:the group
Return type:aiida.orm.implementation.BackendGroup
query(label=None, type_string=None, pk=None, uuid=None, nodes=None, user=None, node_attributes=None, past_days=None, label_filters=None, **kwargs)[source]

Query for groups.

Note:

By default, query for user-defined groups only (type_string==”“). If you want to query for all type of groups, pass type_string=None. If you want to query for a specific type of groups, pass a specific string as the type_string argument.

Parameters:
  • name – the name of the group
  • nodes – a node or list of nodes that belongs to the group (alternatively, you can also pass a DbNode or list of DbNodes)
  • pk – the pk of the group
  • uuid – the uuid of the group
  • type_string – the string for the type of node; by default, look only for user-defined groups (see note above).
  • user – by default, query for groups of all users; if specified, must be a DbUser object, or a string for the user email.
  • past_days – by default, query for all groups; if specified, query the groups created in the last past_days. Must be a datetime object.
  • name_filters – dictionary that can contain ‘startswith’, ‘endswith’ or ‘contains’ as keys
  • node_attributes – if not None, must be a dictionary with format {k: v}. It will filter and return only groups where there is at least a node with an attribute with key=k and value=v. Different keys of the dictionary are joined with AND (that is, the group should satisfy all requirements. v can be a base data type (str, bool, int, float, …) If it is a list or iterable, that the condition is checked so that there should be at least a node in the group with key=k and value=each of the values of the iterable.
  • kwargs

    any other filter to be passed to DbGroup.objects.filter

    Example: if node_attributes = {'elements': ['Ba', 'Ti'], 'md5sum': 'xxx'},
    it will find groups that contain the node with md5sum = ‘xxx’, and moreover contain at least one node for element ‘Ba’ and one node for element ‘Ti’.

Backend group module

class aiida.orm.implementation.logs.BackendLog(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Backend Log interface

__abstractmethods__ = frozenset(['uuid', 'dbnode_id', 'loggername', 'is_stored', 'levelname', 'time', 'message', 'id', 'store', 'metadata'])
__module__ = 'aiida.orm.implementation.logs'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
dbnode_id

Get the id of the object that created the log entry

Returns:The id of the object that created the log entry
Return type:int
levelname

The name of the log level

Returns:The entry log level name
Return type:basestring
loggername

The name of the logger that created this entry

Returns:The entry loggername
Return type:basestring
message

Get the message corresponding to the entry

Returns:The entry message
Return type:basestring
metadata

Get the metadata corresponding to the entry

Returns:The entry metadata
Return type:json.json
time

Get the time corresponding to the entry

Returns:The entry timestamp
Return type:datetime.datetime
uuid

Get the UUID of the log entry

Returns:The entry’s UUID
Return type:uuid.UUID
class aiida.orm.implementation.logs.BackendLogCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of Log entries.

ENTITY_CLASS

alias of BackendLog

__abstractmethods__ = frozenset(['delete_many', 'delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.logs'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332328669
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendLogCollection

delete(log_id)[source]

Remove a Log entry from the collection with the given id

Parameters:log_id – id of the log to delete
delete_many(filters)[source]

Delete multiple log entries in the table

Abstract BackendNode and BackendNodeCollection implementation.

class aiida.orm.implementation.nodes.BackendNode(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

Wrapper around a DbNode instance to set and retrieve data independent of the database implementation.

__abstractmethods__ = frozenset(['delete_attribute', 'attributes_keys', 'extras_keys', 'add_incoming', 'set_attributes', 'get_attribute', 'get_extra', '_increment_version_number', 'delete_extra', 'computer', 'user', 'attributes_items', 'id', 'delete_attributes', 'reset_attributes', 'extras_items', 'clear_attributes', 'delete_extras', 'set_extras', 'reset_extras', 'get_extras', 'set_extra', 'set_attribute', 'is_stored', 'get_attributes', 'clear_extras', 'clone', 'store'])
__module__ = 'aiida.orm.implementation.nodes'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_increment_version_number()[source]

Increment the node version number of this node by one directly in the database.

add_incoming(source, link_type, link_label)[source]

Add a link of the given type from a given node to ourself.

Parameters:
  • source – the node from which the link is coming
  • link_type – the link type
  • link_label – the link label
Returns:

True if the proposed link is allowed, False otherwise

Raises:
  • TypeError – if source is not a Node instance or link_type is not a LinkType enum
  • ValueError – if the proposed link is invalid
attributes

Return the attributes dictionary.

Note

This will fetch all the attributes from the database which can be a heavy operation. If you only need the keys or some values, use the iterators attributes_keys and attributes_items, or the getters get_attribute and get_attributes instead.

Returns:the attributes as a dictionary
attributes_items()[source]

Return an iterator over the attribute items.

Returns:an iterator with attribute key value pairs
attributes_keys()[source]

Return an iterator over the attribute keys.

Returns:an iterator with attribute keys
clear_attributes()[source]

Delete all attributes.

clear_extras()[source]

Delete all extras.

clone()[source]

Return an unstored clone of ourselves.

Returns:an unstored BackendNode with the exact same attributes and extras as self
computer

Return the computer of this node.

Returns:the computer or None
Return type:BackendComputer or None
ctime

Return the node ctime.

Returns:the ctime
delete_attribute(key)[source]

Delete an attribute.

Parameters:key – name of the attribute
Raises:AttributeError – if the attribute does not exist
delete_attributes(keys)[source]

Delete multiple attributes.

Note

The implementation should guarantee that all the keys that are to be deleted actually exist or the entire operation should be canceled without any change and an AttributeError should be raised.

Parameters:keys – names of the attributes to delete
Raises:AttributeError – if at least on of the attribute does not exist
delete_extra(key)[source]

Delete an extra.

Parameters:key – name of the extra
Raises:AttributeError – if the extra does not exist
delete_extras(keys)[source]

Delete multiple extras.

Note

The implementation should guarantee that all the keys that are to be deleted actually exist or the entire operation should be canceled without any change and an AttributeError should be raised.

Parameters:keys – names of the extras to delete
Raises:AttributeError – if at least on of the extra does not exist
description

Return the node description.

Returns:the description
extras

Return the extras dictionary.

Note

This will fetch all the extras from the database which can be a heavy operation. If you only need the keys or some values, use the iterators extras_keys and extras_items, or the getters get_extra and get_extras instead.

Returns:the extras as a dictionary
extras_items()[source]

Return an iterator over the extra items.

Returns:an iterator with extra key value pairs
extras_keys()[source]

Return an iterator over the attribute keys.

Returns:an iterator with attribute keys
get_attribute(key)[source]

Return an attribute.

Parameters:key – name of the attribute
Returns:the value of the attribute
Raises:AttributeError – if the attribute does not exist
get_attributes(keys)[source]

Return a set of attributes.

Parameters:keys – names of the attributes
Returns:the values of the attributes
Raises:AttributeError – if at least one attribute does not exist
get_extra(key)[source]

Return an extra.

Parameters:key – name of the extra
Returns:the value of the extra
Raises:AttributeError – if the extra does not exist
get_extras(keys)[source]

Return a set of extras.

Parameters:keys – names of the extras
Returns:the values of the extras
Raises:AttributeError – if at least one extra does not exist
label

Return the node label.

Returns:the label
mtime

Return the node mtime.

Returns:the mtime
node_type

Return the node type.

Returns:the node type
process_type

Return the node process type.

Returns:the process type
public

Return the node public attribute.

Returns:the public attribute
reset_attributes(attributes)[source]

Reset the attributes.

Note

This will completely reset any existing attributes and replace them with the new dictionary.

Parameters:attributes – the new attributes to set
reset_extras(extras)[source]

Reset the extras.

Note

This will completely reset any existing extras and replace them with the new dictionary.

Parameters:extras – the new extras to set
set_attribute(key, value)[source]

Set an attribute to the given value.

Parameters:
  • key – name of the attribute
  • value – value of the attribute
set_attributes(attributes)[source]

Set attributes.

Note

This will override any existing attributes that are present in the new dictionary.

Parameters:attributes – the new attributes to set
set_extra(key, value, increase_version=True)[source]

Set an extra to the given value.

Parameters:
  • key – name of the extra
  • value – value of the extra
  • increase_version – boolean, if True will increase the node version upon successfully setting the extra
set_extras(extras)[source]

Set extras.

Note

This will override any existing extras that are present in the new dictionary.

Parameters:extras – the new extras to set
store(attributes=None, links=None, with_transaction=True)[source]

Store the node in the database.

Parameters:
  • attributes – optional attributes to set before storing, will override any existing attributes
  • links – optional links to add before storing
  • with_transaction – if False, do not use a transaction because the caller will already have opened one.
user

Return the user of this node.

Returns:the user
Return type:BackendUser
uuid

Return the node UUID.

Returns:the string representation of the UUID
Return type:str or None
version

Return the node version.

Returns:the version
class aiida.orm.implementation.nodes.BackendNodeCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

The collection of BackendNode entries.

ENTITY_CLASS

alias of BackendNode

__abstractmethods__ = frozenset(['delete'])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.nodes'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection,)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332327935
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendNodeCollection

delete(pk)[source]

Remove a Node entry from the collection with the given id

Parameters:pk – id of the node to delete

Backend query implementation classes

class aiida.orm.implementation.querybuilder.BackendQueryBuilder(backend)[source]

Bases: object

Backend query builder interface

AiidaNode

A property, decorated with @property. Returns the implementation for the AiiDA-class for Node

AuthInfo()[source]

A property, decorated with @property. Returns the implementation for the Group

Comment()[source]

A property, decorated with @property. Returns the implementation for the Comment

Computer()[source]

A property, decorated with @property. Returns the implementation for the Computer

Group()[source]

A property, decorated with @property. Returns the implementation for the Group

A property, decorated with @property. Returns the implementation for the DbLink

Log()[source]

A property, decorated with @property. Returns the implementation for the Log

Node()[source]

Decorated as a property, returns the implementation for DbNode. It needs to return a subclass of sqlalchemy.Base, which means that for different ORM’s a corresponding dummy-model must be written.

User()[source]

A property, decorated with @property. Returns the implementation for the User

__abstractmethods__ = frozenset(['Node', 'get_session', 'Group', 'Log', 'get_projectable_attribute', 'Comment', 'get_aiida_res', 'modify_expansions', 'table_groups_nodes', 'yield_per', 'get_filter_expr_from_attributes', 'count', 'AuthInfo', 'Computer', 'Link', 'User', 'iterall', 'iterdict', 'first'])
__dict__ = dict_proxy({'Node': <function Node>, '__module__': 'aiida.orm.implementation.querybuilder', '__abstractmethods__': frozenset(['Node', 'get_session', 'Group', 'Log', 'get_projectable_attribute', 'Comment', 'get_aiida_res', 'modify_expansions', 'table_groups_nodes', 'yield_per', 'get_filter_expr_from_attributes', 'count', 'AuthInfo', 'Computer', 'Link', 'User', 'iterall', 'iterdict', 'first']), 'Group': <function Group>, 'Log': <function Log>, '_abc_negative_cache': <_weakrefset.WeakSet object>, 'get_column': <function get_column>, 'get_filter_expr_from_column': <classmethod object>, 'get_projectable_attribute': <function get_projectable_attribute>, '__dict__': <attribute '__dict__' of 'BackendQueryBuilder' objects>, 'get_session': <function get_session>, '__init__': <function __init__>, 'Comment': <function Comment>, 'get_aiida_res': <function get_aiida_res>, 'modify_expansions': <function modify_expansions>, 'table_groups_nodes': <function table_groups_nodes>, '__weakref__': <attribute '__weakref__' of 'BackendQueryBuilder' objects>, 'yield_per': <function yield_per>, 'get_filter_expr_from_attributes': <aiida.common.lang.abstractclassmethod object>, 'count': <function count>, 'AiidaNode': <property object>, '_abc_cache': <_weakrefset.WeakSet object>, 'AuthInfo': <function AuthInfo>, 'Computer': <function Computer>, 'Link': <function Link>, 'User': <function User>, 'iterall': <function iterall>, '_abc_negative_cache_version': 39, '_abc_registry': <_weakrefset.WeakSet object>, '__doc__': 'Backend query builder interface', 'iterdict': <function iterdict>, 'first': <function first>})
__init__(backend)[source]
Parameters:backend – the backend
__module__ = 'aiida.orm.implementation.querybuilder'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
count(query)[source]
Returns:the number of results
first(query)[source]

Executes query in the backend asking for one instance.

Returns:One row of aiida results
get_aiida_res(key, res)[source]

Some instance returned by ORM (django or SA) need to be converted to Aiida instances (eg nodes)

Parameters:
  • key – the key that this entry would be returned with
  • res – the result returned by the query
Returns:

an aiida-compatible instance

get_column(colname, alias)[source]

Return the column for a given projection.

classmethod get_filter_expr_from_attributes(operator, value, attr_key, column=None, column_name=None, alias=None)[source]

Returns an valid SQLAlchemy expression.

Parameters:
  • operator – The operator provided by the user (‘==’, ‘>’, …)
  • value – The value to compare with, e.g. (5.0, ‘foo’, [‘a’,’b’])
  • attr_key (str) – The path to that attribute as a tuple of values. I.e. if that attribute I want to filter by is the 2nd element in a list stored under the key ‘mylist’, this is (‘mylist’, ‘2’).
  • column – Optional, an instance of sqlalchemy.orm.attributes.InstrumentedAttribute or
  • column_name (str) – The name of the column, and the backend should get the InstrumentedAttribute.
  • alias – The aliased class.
Returns:

An instance of sqlalchemy.sql.elements.BinaryExpression

classmethod get_filter_expr_from_column(operator, value, column)[source]

A method that returns an valid SQLAlchemy expression.

Parameters:
  • operator – The operator provided by the user (‘==’, ‘>’, …)
  • value – The value to compare with, e.g. (5.0, ‘foo’, [‘a’,’b’])
  • column – an instance of sqlalchemy.orm.attributes.InstrumentedAttribute or
Returns:

An instance of sqlalchemy.sql.elements.BinaryExpression

get_projectable_attribute(alias, column_name, attrpath, cast=None, **kwargs)[source]
get_session()[source]
Returns:a valid session, an instance of sqlalchemy.orm.session.Session
iterall(query, batch_size, tag_to_index_dict)[source]
Returns:An iterator over all the results of a list of lists.
iterdict(query, batch_size, tag_to_projected_entity_dict)[source]
Returns:An iterator over all the results of a list of dictionaries.
modify_expansions(alias, expansions)[source]

Modify names of projections if ** was specified. This is important for the schema having attributes in a different table.

table_groups_nodes()[source]

A property, decorated with @property. Returns the implementation for the many-to-many relationship between group and nodes.

yield_per(query, batch_size)[source]
Parameters:batch_size (int) – Number of rows to yield per step

Yields count rows at a time

Returns:a generator

Backend user

class aiida.orm.implementation.users.BackendUser(backend)[source]

Bases: aiida.orm.implementation.backends.BackendEntity

This is the base class for User information in AiiDA. An implementing backend needs to provide a concrete version.

REQUIRED_FIELDS = ['first_name', 'last_name', 'institution']
__abstractmethods__ = frozenset(['first_name', 'last_name', 'institution', 'is_active', 'id', 'get_password', 'is_stored', 'last_login', 'set_password', 'email', 'store', 'date_joined'])
__module__ = 'aiida.orm.implementation.users'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
date_joined
email

Get the email address of the user

Returns:the email address
first_name

Get the user’s first name

Returns:the first name
Return type:str
get_password()[source]

Get the password for the user

Returns:the password
institution

Get the user’s institution

Returns:the institution
Return type:str
is_active
last_login
last_name

Get the user’s last name

Returns:the last name
Return type:str
set_password(new_pass)[source]

Set the password of the user

Parameters:new_pass – the new password
uuid

For now users do not have UUIDs so always return false

Returns:None
class aiida.orm.implementation.users.BackendUserCollection(backend)[source]

Bases: aiida.orm.implementation.backends.BackendCollection

ENTITY_CLASS

alias of BackendUser

__abstractmethods__ = frozenset([])
__args__ = None
__extra__ = None
__module__ = 'aiida.orm.implementation.users'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (aiida.orm.implementation.backends.BackendCollection[aiida.orm.implementation.users.BackendUser],)
__origin__ = None
__parameters__ = ()
__tree_hash__ = 5926332329443
_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of BackendUserCollection