spinedb_api.db_mapping_query_mixin

Module Contents

Classes

DatabaseMappingQueryMixin

Provides the query() method for performing custom SELECT queries.

class spinedb_api.db_mapping_query_mixin.DatabaseMappingQueryMixin(*args, **kwargs)[source]

Provides the query() method for performing custom SELECT queries.

property superclass_subclass_sq[source]

A subquery of the form:

SELECT * FROM superclass_subclass
Returns:

Alias

property entity_class_sq[source]

A subquery of the form:

SELECT * FROM entity_class
Returns:

Alias

property entity_class_dimension_sq[source]

A subquery of the form:

SELECT * FROM entity_class_dimension
Returns:

Alias

property wide_entity_class_sq[source]

A subquery of the form:

SELECT
    ec.*,
    count(ecd.dimension_id) AS dimension_count
    group_concat(ecd.dimension_id) AS dimension_id_list
FROM
    entity_class AS ec
    entity_class_dimension AS ecd
WHERE
    ec.id == ecd.entity_class_id
Returns:

Alias

property entity_sq[source]

A subquery of the form:

SELECT * FROM entity
Returns:

Alias

property entity_element_sq[source]

A subquery of the form:

SELECT * FROM entity_element
Returns:

Alias

property wide_entity_sq[source]

A subquery of the form:

SELECT
    e.*,
    count(ee.element_id) AS element_count
    group_concat(ee.element_id) AS element_id_list
FROM
    entity AS e
    entity_element AS ee
WHERE
    e.id == ee.entity_id
Returns:

Alias

property entity_group_sq[source]

A subquery of the form:

SELECT * FROM entity_group
Returns:

Alias

property alternative_sq[source]

A subquery of the form:

SELECT * FROM alternative
Returns:

Alias

property scenario_sq[source]

A subquery of the form:

SELECT * FROM scenario
Returns:

Alias

property scenario_alternative_sq[source]

A subquery of the form:

SELECT * FROM scenario_alternative
Returns:

Alias

property entity_alternative_sq[source]

A subquery of the form:

SELECT * FROM entity_alternative
Returns:

Alias

property parameter_value_list_sq[source]

A subquery of the form:

SELECT * FROM parameter_value_list
Returns:

Alias

property list_value_sq[source]

A subquery of the form:

SELECT * FROM list_value
Returns:

Alias

property parameter_definition_sq[source]

A subquery of the form:

SELECT * FROM parameter_definition
Returns:

Alias

property parameter_value_sq[source]

A subquery of the form:

SELECT * FROM parameter_value
Returns:

Alias

property metadata_sq[source]

A subquery of the form:

SELECT * FROM list_value
Returns:

Alias

property parameter_value_metadata_sq[source]

A subquery of the form:

SELECT * FROM parameter_value_metadata
Returns:

Alias

property entity_metadata_sq[source]

A subquery of the form:

SELECT * FROM entity_metadata
Returns:

Alias

property commit_sq[source]

A subquery of the form:

SELECT * FROM commit
Returns:

Alias

override_entity_class_sq_maker(method)[source]

Overrides the function that creates the entity_class_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns entity class subquery as an Alias object

override_entity_sq_maker(method)[source]

Overrides the function that creates the entity_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns entity subquery as an Alias object

override_entity_element_sq_maker(method)[source]

Overrides the function that creates the entity_element_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns entity_element subquery as an Alias object

override_parameter_definition_sq_maker(method)[source]

Overrides the function that creates the parameter_definition_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns parameter definition subquery as an Alias object

override_parameter_value_sq_maker(method)[source]

Overrides the function that creates the parameter_value_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns parameter value subquery as an Alias object

override_alternative_sq_maker(method)[source]

Overrides the function that creates the alternative_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns alternative subquery as an Alias object

override_scenario_sq_maker(method)[source]

Overrides the function that creates the scenario_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns scenario subquery as an Alias object

override_scenario_alternative_sq_maker(method)[source]

Overrides the function that creates the scenario_alternative_sq property.

Parameters:

method (Callable) – a function that accepts a DatabaseMapping as its argument and returns scenario alternative subquery as an Alias object

restore_entity_class_sq_maker()[source]

Restores the original function that creates the entity_class_sq property.

restore_entity_sq_maker()[source]

Restores the original function that creates the entity_sq property.

restore_entity_element_sq_maker()[source]

Restores the original function that creates the entity_element_sq property.

restore_parameter_definition_sq_maker()[source]

Restores the original function that creates the parameter_definition_sq property.

restore_parameter_value_sq_maker()[source]

Restores the original function that creates the parameter_value_sq property.

restore_alternative_sq_maker()[source]

Restores the original function that creates the alternative_sq property.

restore_scenario_sq_maker()[source]

Restores the original function that creates the scenario_sq property.

restore_scenario_alternative_sq_maker()[source]

Restores the original function that creates the scenario_alternative_sq property.