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 0x7fee266c3f50; 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 0x7fee266d5b90>, 'datatype': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5890>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5710>, 'dval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5c50>, 'fval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5a10>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5590>, 'ival': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5ad0>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d57d0>, 'tval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5950>}¶
-
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 0x7fee266c3750; 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 0x7fee266d5110>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d54d0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5290>, 'state': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5350>, 'time': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5410>}¶
-
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 0x7fee26740550; 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 0x7fee2673b4d0>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2685be30>, 'enabled': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267e7e90>, 'hostname': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267fe110>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b650>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267fe2f0>, 'scheduler_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267cc650>, 'transport_params': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267cc170>, 'transport_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267cce90>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b710>}¶
-
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 0x7fee266e5a10; 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 0x7fee2673b350>, 'datatype': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b050>, 'dbnode_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5e90>, 'dval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b410>, 'fval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b1d0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5d10>, 'ival': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b290>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee266d5f50>, 'tval': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b110>}¶
-
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 0x7fee2674f7d0; 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 0x7fee26752290>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752710>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752350>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267524d0>, 'time': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752650>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752590>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752110>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267527d0>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752410>}¶
-
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 0x7fee2682ef10; 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 0x7fee2682acb0>, 'input': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2682aa70>, 'input_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2682ad70>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2682afb0>, 'output': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2682abf0>, 'output_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2682ae30>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2682aef0>}¶
-
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 0x7fee267597d0; 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 0x7fee26752cb0>, 'ctime': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267672f0>, 'dbcomputer': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752a70>, 'dbcomputer_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26767470>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26767230>, 'extras': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752d70>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752ef0>, 'label': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26767170>, 'mtime': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267673b0>, 'nodeversion': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267676b0>, 'outputs': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752e30>, 'public': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267675f0>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee267670b0>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752bf0>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26767530>, 'uuid': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee26752fb0>}¶
-
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 0x7fee267a56d0; 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 0x7fee2673bf50>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b950>, 'first_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673bad0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673b7d0>, 'institution': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673bc50>, 'is_active': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673bdd0>, 'is_staff': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673bd10>, 'last_login': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673be90>, 'last_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673bb90>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fee2673ba10>}¶
-
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
¶
-