aiida.backends.djsite.querybuilder_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.backends.djsite.querybuilder_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 0x7f09ca600cd0; DbAttribute>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_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 at 0x7f09ca509b90>, 'datatype': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509890>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509710>, 'dval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509c50>, 'fval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509a10>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509590>, 'ival': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509ad0>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5097d0>, 'tval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509950>}¶
-
bval
¶
-
datatype
¶
-
dbnode_id
¶
-
dval
¶
-
fval
¶
-
id
¶
-
ival
¶
-
key
¶
-
tval
¶
-
-
class
aiida.backends.djsite.querybuilder_django.dummy_model.
DbCalcState
(**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 0x7f09ca6004d0; DbCalcState>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_django.dummy_model'¶
-
__table__
= Table('db_dbcalcstate', MetaData(bind=None), Column('id', Integer(), table=<db_dbcalcstate>, primary_key=True, nullable=False), Column('state', String(length=255), table=<db_dbcalcstate>), Column('time', DateTime(timezone=True), table=<db_dbcalcstate>, default=ColumnDefault(<function <lambda>>)), Column('dbnode_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dbcalcstate>), schema=None)¶
-
__table_args__
= (UniqueConstraint(Column('dbnode_id', Integer(), ForeignKey('db_dbnode.id'), table=<db_dbcalcstate>), Column('state', String(length=255), table=<db_dbcalcstate>)),)¶
-
__tablename__
= 'db_dbcalcstate'¶
-
_sa_class_manager
= {'dbnode': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509110>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5094d0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509290>, 'state': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509350>, 'time': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509410>}¶
-
dbnode
¶
-
dbnode_id
¶
-
id
¶
-
state
¶
-
time
¶
-
-
class
aiida.backends.djsite.querybuilder_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 0x7f09ca531310; DbComputer>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_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 <lambda>>)), 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 at 0x7f09ca52a4d0>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca665e30>, 'enabled': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca66ae30>, 'hostname': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca61fdd0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a650>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5ac230>, 'scheduler_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca66a4d0>, 'transport_params': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a710>, 'transport_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca66a5f0>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5ac2f0>}¶
-
description
¶
-
enabled
¶
-
hostname
¶
-
id
¶
-
name
¶
-
scheduler_type
¶
-
transport_params
¶
-
transport_type
¶
-
uuid
¶
-
-
class
aiida.backends.djsite.querybuilder_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 0x7f09ca519790; DbExtra>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_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 at 0x7f09ca52a350>, 'datatype': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a050>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509e90>, 'dval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a410>, 'fval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a1d0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509d10>, 'ival': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a290>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca509f50>, 'tval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a110>}¶
-
bval
¶
-
datatype
¶
-
dbnode_id
¶
-
dval
¶
-
fval
¶
-
id
¶
-
ival
¶
-
key
¶
-
tval
¶
-
-
class
aiida.backends.djsite.querybuilder_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 0x7f09ca546590; DbGroup>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_django.dummy_model'¶
-
__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 <lambda>>)), Column('name', String(length=255), table=<db_dbgroup>), Column('type', String(length=255), table=<db_dbgroup>, default=ColumnDefault('')), Column('time', DateTime(timezone=True), table=<db_dbgroup>, default=ColumnDefault(<function <lambda>>)), Column('description', Text(), table=<db_dbgroup>), Column('user_id', Integer(), ForeignKey('db_dbuser.id'), table=<db_dbgroup>), schema=None)¶
-
__table_args__
= (UniqueConstraint(Column('name', String(length=255), table=<db_dbgroup>), Column('type', String(length=255), table=<db_dbgroup>, default=ColumnDefault(''))),)¶
-
__tablename__
= 'db_dbgroup'¶
-
_sa_class_manager
= {'dbnodes': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547290>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547710>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547350>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5474d0>, 'time': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547650>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547590>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547110>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5477d0>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547410>}¶
-
dbnodes
¶
-
description
¶
-
id
¶
-
name
¶
-
time
¶
-
type
¶
-
user
¶
-
user_id
¶
-
uuid
¶
-
-
class
aiida.backends.djsite.querybuilder_django.dummy_model.
DbLink
(**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 0x7f09ca5e8c50; DbLink>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_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 at 0x7f09ca5e4cb0>, 'input': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5e4a70>, 'input_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5e4d70>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5e4fb0>, 'output': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5e4bf0>, 'output_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5e4e30>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5e4ef0>}¶
-
id
¶
-
input
¶
-
input_id
¶
-
label
¶
-
output
¶
-
output_id
¶
-
type
¶
-
-
class
aiida.backends.djsite.querybuilder_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 0x7f09ca54e590; DbNode>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_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 <lambda>>)), Column('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 <lambda>>)), Column('mtime', DateTime(timezone=True), table=<db_dbnode>, default=ColumnDefault(<function <lambda>>)), 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 at 0x7f09ca547cb0>, 'ctime': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5592f0>, 'dbcomputer': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547a70>, 'dbcomputer_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca559470>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca559230>, 'extras': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547d70>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547ef0>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca559170>, 'mtime': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5593b0>, 'nodeversion': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5596b0>, 'outputs': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547e30>, 'public': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5595f0>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca5590b0>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547bf0>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca559530>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca547fb0>}¶
-
attributes
¶
-
computer_name
= <sqlalchemy.sql.elements.Label object>¶
-
ctime
¶
-
dbcomputer
¶
-
dbcomputer_id
¶
-
description
¶
-
extras
¶
-
get_aiida_class
()[source]¶ Return the corresponding instance of
Node()
or a subclass return by the plugin loader.Todo
The behavior is quite pathetic, creating a django DbNode instance to instantiate the aiida instance. These means that every time you load Aiida instances with the QueryBuilder when using Django as a backend, three instances are instantiated for every Aiida instance you load! Could be fixed by allowing DbNode from the dummy nodel to be passed to AiidaNode’s __init__.
Returns: An instance of the plugin class
-
id
¶
-
label
¶
-
mtime
¶
-
nodeversion
¶
-
outputs
¶
-
public
¶
-
state
= <sqlalchemy.sql.elements.Label object>¶
-
type
¶
-
user
¶
-
user_email
= <sqlalchemy.sql.elements.Label object>¶
-
user_id
¶
-
uuid
¶
-
-
class
aiida.backends.djsite.querybuilder_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 0x7f09ca655850; DbUser>¶
-
__module__
= 'aiida.backends.djsite.querybuilder_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 <lambda>>)), Column('date_joined', DateTime(timezone=True), table=<db_dbuser>, default=ColumnDefault(<function <lambda>>)), schema=None)¶
-
__tablename__
= 'db_dbuser'¶
-
_sa_class_manager
= {'date_joined': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52af50>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a950>, 'first_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52aad0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52a7d0>, 'institution': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52ac50>, 'is_active': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52add0>, 'is_staff': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52ad10>, 'last_login': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52ae90>, 'last_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52ab90>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f09ca52aa10>}¶
-
date_joined
¶
-
email
¶
-
first_name
¶
-
id
¶
-
institution
¶
-
is_active
¶
-
is_staff
¶
-
last_login
¶
-
last_name
¶
-
password
¶
-
-
aiida.backends.djsite.querybuilder_django.dummy_model.
get_aldjemy_session
()[source]¶ Use aldjemy to make a session
-
class
aiida.backends.djsite.querybuilder_django.querybuilder_django.
QueryBuilderImplDjango
(*args, **kwargs)[source]¶ Bases:
aiida.backends.general.querybuilder_interface.QueryBuilderInterface
-
AiidaComputer
¶
-
AiidaGroup
¶
-
AiidaNode
¶
-
AiidaUser
¶
-
Computer
¶
-
Group
¶
-
Link
¶
-
Node
¶
-
User
¶
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.backends.djsite.querybuilder_django.querybuilder_django'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 40¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
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: - res – the result returned by the query
- key – the key that this entry would be return with
Returns: an aiida-compatible instance
-
get_filter_expr
(operator, value, attr_key, is_attribute, alias=None, column=None, column_name=None)[source]¶ Applies a filter on the alias given. Expects the alias of the ORM-class on which to filter, and filter_spec. Filter_spec contains the specification on the filter. Expects:
Parameters: - operator – The operator to apply, see below for further details
- value – The value for the right side of the expression, the value you want to compare with.
- path – The path leading to the value
- attr_key – Boolean, whether the value is in a json-column, or in an attribute like table.
Implemented and valid operators:
for any type: * == (compare single value, eg: ‘==’:5.0) * in (compare whether in list, eg: ‘in’:[5, 6, 34]
- for floats and integers:
- >
- <
- <=
- >=
- for strings:
- like (case - sensitive), for example ‘like’:’node.calc.%’ will match node.calc.relax and node.calc.RELAX and node.calc. but not node.CALC.relax
- ilike (case - unsensitive) will also match node.CaLc.relax in the above example
Note
The character % is a reserved special character in SQL, and acts as a wildcard. If you specifically want to capture a
%
in the string, use:_%
for arrays and dictionaries (only for the SQLAlchemy implementation):
- contains: pass a list with all the items that the array should contain, or that should be among the keys, eg: ‘contains’: [‘N’, ‘H’])
- has_key: pass an element that the list has to contain or that has to be a key, eg: ‘has_key’:’N’)
- for arrays only (SQLAlchemy version):
- of_length
- longer
- shorter
All the above filters invoke a negation of the expression if preceded by ~:
# first example: filter_spec = { 'name' : { '~in':[ 'halle', 'lujah' ] } # Name not 'halle' or 'lujah' } # second example: filter_spec = { 'id' : { '~==': 2 } } # id is not 2
-
get_filter_expr_from_attributes
(operator, value, attr_key, column=None, column_name=None, alias=None)[source]¶ A classmethod 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’])
- 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
-
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]¶ For the Django schema, we have as additioanl expansions ‘attributes’ and ‘extras’
-
table_groups_nodes
¶
-