aiida.orm.implementation.django package

Submodules

The dummy model encodes the model defined by django in backends.djsite using SQLAlchemy. This is done to query the database with more performant ORM of SA.

class aiida.orm.implementation.django.dummy_model.DbAttribute(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b95ea90; DbAttribute>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbattribute', MetaData(bind=None), Column('id', Integer(), table=<db_dbattribute>, primary_key=True, nullable=False), Column('dbnode_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dbattribute>), Column('key', String(length=255), table=<db_dbattribute>), Column('datatype', String(length=10), table=<db_dbattribute>), Column('tval', String(), table=<db_dbattribute>, default=ColumnDefault('')), Column('fval', Float(), table=<db_dbattribute>), Column('ival', Integer(), table=<db_dbattribute>), Column('bval', Boolean(), table=<db_dbattribute>), Column('dval', DateTime(), table=<db_dbattribute>), schema=None)
__tablename__ = 'db_dbattribute'
_sa_class_manager = {'bval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'datatype': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'fval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ival': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
bval
datatype
dbnode_id
dval
fval
id
ival
key
tval
class aiida.orm.implementation.django.dummy_model.DbAuthInfo(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b9c6050; DbAuthInfo>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbauthinfo', MetaData(bind=None), Column('id', Integer(), table=<db_dbauthinfo>, primary_key=True, nullable=False), Column('aiidauser_id', Integer(), ForeignKey('db_dbuser.id'), table=<db_dbauthinfo>), Column('dbcomputer_id', Integer(), ForeignKey('db_dbcomputer.id'), table=<db_dbauthinfo>), Column('metadata', String(length=255), table=<db_dbauthinfo>, default=ColumnDefault('{}')), Column('auth_params', String(length=255), table=<db_dbauthinfo>, default=ColumnDefault('{}')), Column('enabled', Boolean(), table=<db_dbauthinfo>, default=ColumnDefault(True)), schema=None)
__table_args__ = (UniqueConstraint(Column('aiidauser_id', Integer(), ForeignKey('db_dbuser.id'), table=<db_dbauthinfo>), Column('dbcomputer_id', Integer(), ForeignKey('db_dbcomputer.id'), table=<db_dbauthinfo>)),)
__tablename__ = 'db_dbauthinfo'
_metadata
_sa_class_manager = {'_metadata': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'aiidauser': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'aiidauser_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, u'auth_params': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbcomputer': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbcomputer_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'enabled': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
aiidauser
aiidauser_id
auth_params
dbcomputer
dbcomputer_id
enabled
id
class aiida.orm.implementation.django.dummy_model.DbComment(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b6dc290; DbComment>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbcomment', MetaData(bind=None), Column('id', Integer(), table=<db_dbcomment>, primary_key=True, nullable=False), Column('uuid', UUID(as_uuid=True), table=<db_dbcomment>, default=ColumnDefault(<function get_new_uuid>)), Column('dbnode_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dbcomment>), Column('ctime', DateTime(timezone=True), table=<db_dbcomment>, default=ColumnDefault(<function now>)), Column('mtime', DateTime(timezone=True), table=<db_dbcomment>, onupdate=ColumnDefault(<function now>), default=ColumnDefault(<function now>)), Column('user_id', Integer(), ForeignKey('db_dbuser.id'), table=<db_dbcomment>), Column('content', Text(), table=<db_dbcomment>), schema=None)
__tablename__ = 'db_dbcomment'
_sa_class_manager = {'content': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ctime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbnode': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'mtime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
content
ctime
dbnode
dbnode_id
id
mtime
user
user_id
uuid
class aiida.orm.implementation.django.dummy_model.DbComputer(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b70cbd0; DbComputer>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbcomputer', MetaData(bind=None), Column('id', Integer(), table=<db_dbcomputer>, primary_key=True, nullable=False), Column('uuid', UUID(as_uuid=True), table=<db_dbcomputer>, default=ColumnDefault(<function get_new_uuid>)), Column('name', String(length=255), table=<db_dbcomputer>, nullable=False), Column('hostname', String(length=255), table=<db_dbcomputer>), Column('description', Text(), table=<db_dbcomputer>), Column('enabled', Boolean(), table=<db_dbcomputer>), Column('transport_type', String(length=255), table=<db_dbcomputer>), Column('scheduler_type', String(length=255), table=<db_dbcomputer>), Column('transport_params', String(length=255), table=<db_dbcomputer>), Column('metadata', String(length=255), table=<db_dbcomputer>, default=ColumnDefault('{}')), schema=None)
__tablename__ = 'db_dbcomputer'
_metadata
_sa_class_manager = {'_metadata': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'enabled': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'hostname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'scheduler_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'transport_params': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'transport_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
description
enabled
hostname
id
name
scheduler_type
transport_params
transport_type
uuid
class aiida.orm.implementation.django.dummy_model.DbExtra(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b70c290; DbExtra>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbextra', MetaData(bind=None), Column('id', Integer(), table=<db_dbextra>, primary_key=True, nullable=False), Column('dbnode_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dbextra>), Column('key', String(length=255), table=<db_dbextra>), Column('datatype', String(length=10), table=<db_dbextra>), Column('tval', String(), table=<db_dbextra>, default=ColumnDefault('')), Column('fval', Float(), table=<db_dbextra>), Column('ival', Integer(), table=<db_dbextra>), Column('bval', Boolean(), table=<db_dbextra>), Column('dval', DateTime(), table=<db_dbextra>), schema=None)
__tablename__ = 'db_dbextra'
_sa_class_manager = {'bval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'datatype': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'fval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ival': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tval': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
bval
datatype
dbnode_id
dval
fval
id
ival
key
tval
class aiida.orm.implementation.django.dummy_model.DbGroup(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b9c16d0; DbGroup>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__str__() <==> str(x)[source]
__table__ = Table('db_dbgroup', MetaData(bind=None), Column('id', Integer(), table=<db_dbgroup>, primary_key=True, nullable=False), Column('uuid', UUID(as_uuid=True), table=<db_dbgroup>, default=ColumnDefault(<function get_new_uuid>)), Column('label', String(length=255), table=<db_dbgroup>), Column('type_string', String(length=255), table=<db_dbgroup>, default=ColumnDefault('')), Column('time', DateTime(timezone=True), table=<db_dbgroup>, default=ColumnDefault(<function now>)), Column('description', Text(), table=<db_dbgroup>), Column('user_id', Integer(), ForeignKey('db_dbuser.id'), table=<db_dbgroup>), schema=None)
__table_args__ = (UniqueConstraint(Column('label', String(length=255), table=<db_dbgroup>), Column('type_string', String(length=255), table=<db_dbgroup>, default=ColumnDefault(''))),)
__tablename__ = 'db_dbgroup'
_sa_class_manager = {'dbnodes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'time': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'type_string': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
dbnodes
description
id
label
time
type_string
user
user_id
uuid

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9c3ef3d0; DbLink>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dblink', MetaData(bind=None), Column('id', Integer(), table=<db_dblink>, primary_key=True, nullable=False), Column('input_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dblink>), Column('output_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dblink>), Column('type', String(length=255), table=<db_dblink>), Column('label', String(length=255), table=<db_dblink>, nullable=False), schema=None)
__tablename__ = 'db_dblink'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'input': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'input_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'output': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'output_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
id
input
input_id
label
output
output_id
type
class aiida.orm.implementation.django.dummy_model.DbLog(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b9c6a50; DbLog>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dblog', MetaData(bind=None), Column('id', Integer(), table=<db_dblog>, primary_key=True, nullable=False), Column('uuid', UUID(as_uuid=True), table=<db_dblog>, default=ColumnDefault(<function get_new_uuid>)), Column('time', DateTime(timezone=True), table=<db_dblog>, default=ColumnDefault(<function now>)), Column('loggername', String(length=255), table=<db_dblog>), Column('levelname', String(length=255), table=<db_dblog>), Column('dbnode_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dblog>), Column('message', Text(), table=<db_dblog>), Column('metadata', String(length=255), table=<db_dblog>, default=ColumnDefault('{}')), schema=None)
__tablename__ = 'db_dblog'
_metadata
_sa_class_manager = {'_metadata': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbnode': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'levelname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'loggername': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'message': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'time': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
dbnode
dbnode_id
id
levelname
loggername
message
time
uuid
class aiida.orm.implementation.django.dummy_model.DbNode(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b9c4410; DbNode>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbnode', MetaData(bind=None), Column('id', Integer(), table=<db_dbnode>, primary_key=True, nullable=False), Column('uuid', UUID(as_uuid=True), table=<db_dbnode>, default=ColumnDefault(<function get_new_uuid>)), Column('node_type', String(length=255), table=<db_dbnode>), Column('process_type', String(length=255), table=<db_dbnode>), Column('label', String(length=255), table=<db_dbnode>), Column('description', Text(), table=<db_dbnode>), Column('ctime', DateTime(timezone=True), table=<db_dbnode>, default=ColumnDefault(<function now>)), Column('mtime', DateTime(timezone=True), table=<db_dbnode>, default=ColumnDefault(<function now>)), Column('dbcomputer_id', Integer(), ForeignKey('db_dbcomputer.id'), table=<db_dbnode>), Column('user_id', Integer(), ForeignKey('db_dbuser.id'), table=<db_dbnode>, nullable=False), Column('public', Boolean(), table=<db_dbnode>, default=ColumnDefault(False)), Column('nodeversion', Integer(), table=<db_dbnode>, default=ColumnDefault(1)), schema=None)
__tablename__ = 'db_dbnode'
_sa_class_manager = {'attributes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ctime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbcomputer': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'dbcomputer_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'extras': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'mtime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'node_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'nodeversion': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'outputs': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'process_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'public': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
attributes
computer_name

Returns: the name of the computer at a class level (i.e. in the database)

ctime
dbcomputer
dbcomputer_id
description
extras
id
label
mtime
node_type
nodeversion
outputs
process_type
public
user
user_email

Returns: the email of the user at a class level (i.e. in the database)

user_id
uuid
class aiida.orm.implementation.django.dummy_model.DbUser(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7ffb9b711650; DbUser>
__module__ = 'aiida.orm.implementation.django.dummy_model'
__table__ = Table('db_dbuser', MetaData(bind=None), Column('id', Integer(), table=<db_dbuser>, primary_key=True, nullable=False), Column('email', String(length=254), table=<db_dbuser>), Column('password', String(length=128), table=<db_dbuser>), Column('first_name', String(length=254), table=<db_dbuser>), Column('last_name', String(length=254), table=<db_dbuser>), Column('institution', String(length=254), table=<db_dbuser>), Column('is_staff', Boolean(), table=<db_dbuser>, default=ColumnDefault(False)), Column('is_active', Boolean(), table=<db_dbuser>, default=ColumnDefault(False)), Column('last_login', DateTime(timezone=True), table=<db_dbuser>, default=ColumnDefault(<function now>)), Column('date_joined', DateTime(timezone=True), table=<db_dbuser>, default=ColumnDefault(<function now>)), schema=None)
__tablename__ = 'db_dbuser'
_sa_class_manager = {'date_joined': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'first_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'institution': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'is_active': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'is_staff': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'last_login': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'last_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
date_joined
email
first_name
id
institution
is_active
is_staff
last_login
last_name
password
aiida.orm.implementation.django.dummy_model.get_aldjemy_session()[source]

Use aldjemy to make a session

Classes and methods for Django specific backend entities

class aiida.orm.implementation.django.entities.DjangoModelEntity(*args, **kwargs)[source]

Bases: typing.Generic

A mixin that adds some common Django backend entity methods

MODEL_CLASS = None
__abstractmethods__ = frozenset([])
__args__ = None
__dict__ = dict_proxy({'_abc_cache': <_weakrefset.WeakSet object>, '__module__': 'aiida.orm.implementation.django.entities', 'from_dbmodel': <classmethod object>, '__args__': None, u'__origin__': None, '__tree_hash__': 5926337717111, 'get_dbmodel_attribute_name': <classmethod object>, 'is_stored': <property object>, 'MODEL_CLASS': None, '__dict__': <attribute '__dict__' of 'DjangoModelEntity' objects>, 'dbmodel': <property object>, '__weakref__': <attribute '__weakref__' of 'DjangoModelEntity' objects>, 'id': <property object>, '__init__': <function __init__>, '_dbmodel': None, '_abc_generic_negative_cache_version': 102, '_abc_registry': <_weakrefset.WeakSet object>, '__abstractmethods__': frozenset([]), '__next_in_mro__': <type 'object'>, '_gorg': aiida.orm.implementation.django.entities.DjangoModelEntity, '__parameters__': (~ModelType,), '_auto_flush': (), 'pk': <property object>, '__orig_bases__': (typing.Generic[~ModelType],), '_abc_generic_negative_cache': <_weakrefset.WeakSet object>, '_class_check': <classmethod object>, '__doc__': 'A mixin that adds some common Django backend entity methods', 'store': <function store>, u'__extra__': None})
__extra__ = None
__init__(*args, **kwargs)[source]

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

__module__ = 'aiida.orm.implementation.django.entities'
__next_in_mro__

alias of __builtin__.object

__orig_bases__ = (typing.Generic[~ModelType],)
__origin__ = None
__parameters__ = (~ModelType,)
__tree_hash__ = 5926337717111
__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 = 102
_abc_registry = <_weakrefset.WeakSet object>
_auto_flush = ()
classmethod _class_check()[source]

Assert that the class is correctly configured

_dbmodel = None
_gorg

alias of DjangoModelEntity

dbmodel
classmethod from_dbmodel(dbmodel, backend)[source]

Create a DjangoEntity from the corresponding db model class

Parameters:
  • dbmodel – the model to create the entity from
  • backend – the corresponding backend
Returns:

the Django entity

classmethod get_dbmodel_attribute_name(attr_name)[source]

Given the name of an attribute of the entity class give the corresponding name of the attribute in the db model. It if doesn’t exit this raises a ValueError

Parameters:attr_name
Returns:the dbmodel attribute name
Return type:str
id
is_stored

Is this entity stored?

Returns:True if stored, False otherwise
pk

Get the principal key for this entry

Returns:the principal key
store()[source]

Store the entity

Returns:the entity itself
class aiida.orm.implementation.django.utils.ModelWrapper(model, auto_flush=())[source]

Bases: object

This wraps a Django model delegating all get/set attributes to the underlying model class, BUT it will make sure that if the model is stored then: * before every read it has the latest value from the database, and, * after ever write the updated value is flushed to the database.

__dict__ = dict_proxy({'__module__': 'aiida.orm.implementation.django.utils', '__setattr__': <function __setattr__>, '__getattr__': <function __getattr__>, '_ensure_model_uptodate': <function _ensure_model_uptodate>, '_flush': <function _flush>, 'is_saved': <function is_saved>, '_is_model_field': <function _is_model_field>, '__dict__': <attribute '__dict__' of 'ModelWrapper' objects>, 'save': <function save>, '__weakref__': <attribute '__weakref__' of 'ModelWrapper' objects>, '__doc__': '\n This wraps a Django model delegating all get/set attributes to the\n underlying model class, BUT it will make sure that if the model is\n stored then:\n * before every read it has the latest value from the database, and,\n * after ever write the updated value is flushed to the database.\n ', '__init__': <function __init__>})
__getattr__(item)[source]
__init__(model, auto_flush=())[source]

Construct the ModelWrapper.

Parameters:
  • model – the database model instance to wrap
  • auto_flush – an optional tuple of database model fields that are always to be flushed, in addition to the field that corresponds to the attribute being set through __setattr__.
__module__ = 'aiida.orm.implementation.django.utils'
__setattr__(key, value)[source]

x.__setattr__(‘name’, value) <==> x.name = value

__weakref__

list of weak references to the object (if defined)

_ensure_model_uptodate(fields=None)[source]
_flush(fields=None)[source]

If the user is stored then save the current value

_is_model_field(name)[source]
is_saved()[source]
save()[source]

Save the model (possibly updating values if changed)