spinetoolbox.spine_db_worker
The SpineDBWorker class.
Module Contents
Classes
Does all the communication with a certain DB for SpineDBManager, in a non-GUI thread. |
Attributes
- class spinetoolbox.spine_db_worker.SpineDBWorker(db_mngr, db_url, synchronous=False)[source]
Bases:
PySide6.QtCore.QObject
Does all the communication with a certain DB for SpineDBManager, in a non-GUI thread.
- register_fetch_parent(parent)[source]
Registers the given parent.
- Parameters
parent (FetchParent) – parent to add
- _iterate_mapping(parent)[source]
Iterates the in-memory mapping for given parent while updating its
position
property. Iterated items are added to the parent if it accepts them.- Parameters
parent (FetchParent) – the parent.
- Returns
Whether the parent can stop fetching from now
- Return type
bool
- can_fetch_more(parent)[source]
Returns whether more data can be fetched for parent. Also, registers the parent to notify it of any relevant DB modifications later on.
- Parameters
parent (FetchParent) – fetch parent
- Returns
True if more data is available, False otherwise
- Return type
bool
- fetch_more(parent)[source]
Fetches items from the database.
- Parameters
parent (FetchParent) – fetch parent
- add_items(item_type, orig_items, check)[source]
Adds items to db.
- Parameters
item_type (str) – item type
orig_items (list) – dict-items to add
check (bool) – Whether to check integrity
- update_items(item_type, orig_items, check)[source]
Updates items in db.
- Parameters
item_type (str) – item type
orig_items (list) – dict-items to update
check (bool) – Whether or not to check integrity
- add_update_items(item_type, orig_items, check)[source]
Add-updates items in db.
- Parameters
item_type (str) – item type
orig_items (list) – dict-items to update
check (bool) – Whether or not to check integrity
- remove_items(item_type, ids, check)[source]
Removes items from database.
- Parameters
item_type (str) – item type
ids (set) – ids of items to remove