spinedb_api.filters.renamer

Provides a database query manipulator that renames database items.

Module Contents

Functions

apply_renaming_to_entity_class_sq(db_map, name_map)

Applies renaming to entity class subquery.

entity_class_renamer_config(**renames)

Creates a config dict for renamer.

entity_class_renamer_from_dict(db_map, config)

Applies entity class renamer manipulator to given database map.

entity_class_renamer_config_to_shorthand(config)

Makes a shorthand string from renamer configuration.

entity_class_renamer_shorthand_to_config(shorthand)

Makes configuration dictionary out of a shorthand string.

apply_renaming_to_parameter_definition_sq(db_map, name_map)

Applies renaming to parameter definition subquery.

parameter_renamer_config(renames)

Creates a config dict for renamer.

parameter_renamer_from_dict(db_map, config)

Applies parameter renamer manipulator to given database map.

parameter_renamer_config_to_shorthand(config)

Makes a shorthand string from renamer configuration.

parameter_renamer_shorthand_to_config(shorthand)

Makes configuration dictionary out of a shorthand string.

spinedb_api.filters.renamer.apply_renaming_to_entity_class_sq(db_map, name_map)[source]

Applies renaming to entity class subquery.

Parameters:
  • db_map (DatabaseMapping) – a database map

  • name_map (dict) – a map from old name to new name

spinedb_api.filters.renamer.entity_class_renamer_config(**renames)[source]

Creates a config dict for renamer.

Parameters:

**renames – keyword is the old name, value is the new name

Returns:

renamer configuration

Return type:

dict

spinedb_api.filters.renamer.entity_class_renamer_from_dict(db_map, config)[source]

Applies entity class renamer manipulator to given database map.

Parameters:
spinedb_api.filters.renamer.entity_class_renamer_config_to_shorthand(config)[source]

Makes a shorthand string from renamer configuration.

Parameters:

config (dict) – renamer configuration

Returns:

a shorthand string

Return type:

str

spinedb_api.filters.renamer.entity_class_renamer_shorthand_to_config(shorthand)[source]

Makes configuration dictionary out of a shorthand string.

Parameters:

shorthand (str) – a shorthand string

Returns:

renamer configuration

Return type:

dict

spinedb_api.filters.renamer.apply_renaming_to_parameter_definition_sq(db_map, name_map)[source]

Applies renaming to parameter definition subquery.

Parameters:
  • db_map (DatabaseMapping) – a database map

  • name_map (dict) – a map from old name to new name

spinedb_api.filters.renamer.parameter_renamer_config(renames)[source]

Creates a config dict for renamer.

Parameters:

renames (dict) – mapping from entity class name to mapping from parameter name to new name

Returns:

renamer configuration

Return type:

dict

spinedb_api.filters.renamer.parameter_renamer_from_dict(db_map, config)[source]

Applies parameter renamer manipulator to given database map.

Parameters:
spinedb_api.filters.renamer.parameter_renamer_config_to_shorthand(config)[source]

Makes a shorthand string from renamer configuration.

Parameters:

config (dict) – renamer configuration

Returns:

a shorthand string

Return type:

str

spinedb_api.filters.renamer.parameter_renamer_shorthand_to_config(shorthand)[source]

Makes configuration dictionary out of a shorthand string.

Parameters:

shorthand (str) – a shorthand string

Returns:

renamer configuration

Return type:

dict