spinedb_api.filters.execution_filter

Provides functions to apply filtering based on scenarios to parameter value subqueries.

Module Contents

Functions

apply_execution_filter(db_map, execution)

Replaces the import alternative in db_map with a dedicated alternative for an execution.

execution_filter_config(execution)

Creates a config dict for execution filter.

execution_filter_from_dict(db_map, config)

Applies execution filter to given database map.

execution_descriptor_from_dict(config)

Returns execution descriptor from filter config.

execution_filter_config_to_shorthand(config)

Makes a shorthand string from execution filter configuration.

execution_filter_shorthand_to_config(shorthand)

Makes configuration dictionary out of a shorthand string.

spinedb_api.filters.execution_filter.apply_execution_filter(db_map, execution)[source]

Replaces the import alternative in db_map with a dedicated alternative for an execution.

Parameters:
  • db_map (DatabaseMapping) – a database map to alter

  • execution (dict) – execution descriptor

spinedb_api.filters.execution_filter.execution_filter_config(execution)[source]

Creates a config dict for execution filter.

Parameters:

execution (dict) – execution descriptor

Returns:

filter configuration

Return type:

dict

spinedb_api.filters.execution_filter.execution_filter_from_dict(db_map, config)[source]

Applies execution filter to given database map.

Parameters:
  • db_map (DatabaseMapping) – target database map

  • config (dict) – execution filter configuration

spinedb_api.filters.execution_filter.execution_descriptor_from_dict(config)[source]

Returns execution descriptor from filter config.

Parameters:

config (dict) – execution filter configuration

Returns:

execution descriptor or None if config is not a valid execution filter configuration

Return type:

dict

spinedb_api.filters.execution_filter.execution_filter_config_to_shorthand(config)[source]

Makes a shorthand string from execution filter configuration.

Parameters:

config (dict) – execution filter configuration

Returns:

a shorthand string

Return type:

str

spinedb_api.filters.execution_filter.execution_filter_shorthand_to_config(shorthand)[source]

Makes configuration dictionary out of a shorthand string.

Parameters:

shorthand (str) – a shorthand string

Returns:

execution filter configuration

Return type:

dict