spinetoolbox.spine_db_worker

The SpineDBWorker class

authors
  1. Vennström (VTT) and M. Marin (KTH)

date

2.10.2019

Module Contents

Classes

SpineDBWorker

Does all the DB communication for SpineDBManager, in the non-GUI thread.

class spinetoolbox.spine_db_worker.SpineDBWorker(db_mngr)[source]

Bases: PySide2.QtCore.QObject

Does all the DB communication for SpineDBManager, in the non-GUI thread.

connection_closed[source]
_get_db_map_called[source]
_close_db_map_called[source]
_add_or_update_items_called[source]
_remove_items_called[source]
_commit_session_called[source]
_rollback_session_called[source]
_import_data_called[source]
_set_scenario_alternatives_called[source]
_set_parameter_definition_tags_called[source]
_export_data_called[source]
_duplicate_object_called[source]
connect_signals(self)[source]
get_db_map(self, *args, **kwargs)[source]
_get_db_map(self)[source]
close_db_map(self, db_map)[source]
_close_db_map(self, db_map)[source]
add_or_update_items(self, db_map_data, method_name, getter_name, signal_name)[source]
_add_or_update_items(self, db_map_data, method_name, getter_name, signal_name)[source]

Adds or updates items in db.

Parameters
  • db_map_data (dict) – lists of items to add or update keyed by DiffDatabaseMapping

  • method_name (str) – attribute of DiffDatabaseMapping to call for performing the operation

  • getter_name (str) – attribute of SpineDBManager to call for getting affected items

  • signal_name (str) – signal attribute of SpineDBManager to emit if successful

remove_items(self, db_map_typed_ids)[source]
_remove_items(self, db_map_typed_ids)[source]

Removes items from database.

Parameters

db_map_typed_ids (dict) – lists of items to remove, keyed by item type (str), keyed by DiffDatabaseMapping

commit_session(self, dirty_db_maps, commit_msg, cookie=None)[source]
_commit_session(self, dirty_db_maps, commit_msg, cookie=None)[source]
rollback_session(self, dirty_db_maps)[source]
_rollback_session(self, dirty_db_maps)[source]
import_data(self, db_map_data, command_text='Import data')[source]
_import_data(self, db_map_data, command_text='Import data')[source]
export_data(self, caller, db_map_item_ids, file_path, file_filter)[source]
_get_data_for_export(self, db_map_item_ids)[source]
_export_data(self, caller, db_map_item_ids, file_path, file_filter)[source]
export_to_sqlite(self, file_path, data_for_export, caller)[source]

Exports given data into SQLite file.

export_to_json(self, file_path, data_for_export, caller)[source]

Exports given data into JSON file.

export_to_excel(self, file_path, data_for_export, caller)[source]

Exports given data into Excel file.

duplicate_object(self, db_maps, object_data, orig_name, dup_name)[source]
_duplicate_object(self, db_maps, object_data, orig_name, dup_name)[source]
set_scenario_alternatives(self, db_map_data)[source]
_set_scenario_alternatives(self, db_map_data)[source]
set_parameter_definition_tags(self, db_map_data)[source]
_set_parameter_definition_tags(self, db_map_data)[source]
_refresh(self, signal_name, db_map_data)[source]
_refresh_scenario_alternatives(self, db_map_data)[source]

Refreshes cached scenarios when updating scenario alternatives.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_refresh_parameter_definitions_by_tag(self, db_map_data)[source]

Refreshes cached parameter definitions when updating parameter tags.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_relationship_classes(self, db_map_data)[source]

Refreshes cached relationship classes when updating object classes.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_relationships_by_object(self, db_map_data)[source]

Refreshed cached relationships in cascade when updating objects.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_definitions(self, db_map_data)[source]

Refreshes cached parameter definitions in cascade when updating entity classes.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_definitions_by_value_list(self, db_map_data)[source]

Refreshes cached parameter definitions when updating parameter_value lists.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_values_by_entity_class(self, db_map_data)[source]

Refreshes cached parameter values in cascade when updating entity classes.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_values_by_entity(self, db_map_data)[source]

Refreshes cached parameter values in cascade when updating entities.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_values_by_alternative(self, db_map_data)[source]

Refreshes cached parameter values in cascade when updating alternatives.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_values_by_definition(self, db_map_data)[source]

Refreshes cached parameter values in cascade when updating parameter definitions.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_parameter_definitions_by_tag(self, db_map_data)[source]

Refreshes cached parameter definitions when updating parameter tags.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_features_by_paremeter_definition(self, db_map_data)[source]

Refreshes cached features in cascade when updating parameter definitions.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_features_by_paremeter_value_list(self, db_map_data)[source]

Refreshes cached features in cascade when updating parameter value lists.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_cascade_refresh_tool_features_by_feature(self, db_map_data)[source]

Refreshes cached tool features in cascade when updating features.

Parameters

db_map_data (dict) – lists of updated items keyed by DiffDatabaseMapping

_db_map_ids(self, db_map_data)[source]