spinetoolbox.spine_io.connection_manager¶
Contains ConnectionManager class.
| author: |
|
|---|---|
| date: | 1.6.2019 |
Module Contents¶
-
class
spinetoolbox.spine_io.connection_manager.ConnectionManager(connection, parent=None)[source]¶ Bases:
PySide2.QtCore.QObjectClass to manage data connections in another thread.
Parameters: connection (class) – A class derived from SourceConnection, e.g. CSVConnector -
set_table(self, table)[source]¶ Sets the current table of the data source.
Parameters: {str} -- str with table name (table) –
-
request_tables(self)[source]¶ Get tables tables from source, emits two singals, fetchingData: ConnectionManager is busy waiting for data startTableGet: a signal that the worker in another thread is listening to know when to run get a list of table names.
-
request_data(self, table=None, max_rows=-1)[source]¶ Request data from emits dataReady to with data
Keyword Arguments: - {str} -- which table to get data from (default (table) – {None})
- {int} -- how many rows to read (default (max_rows) – {-1})
-
request_mapped_data(self, table_mappings, max_rows=-1)[source]¶ Get mapped data from csv file
Parameters: {dict} -- dict with filename as key and a list of mappings as value (table_mappings) – Keyword Arguments: {int} -- number of rows to read, if -1 read all rows (default (max_rows) – {-1})
-
connection_ui(self)[source]¶ launches a modal ui that prompts the user to select source.
ex: fileselect if source is a file.
-
init_connection(self)[source]¶ Creates a Worker and a new thread to read source data. If there is an existing thread close that one.
-
set_table_options(self, options)[source]¶ Sets connection manager options for current connector
Parameters: {dict} -- Dict with option settings (options) –
-
set_table_types(self, types)[source]¶ Sets connection manager types for current connector
Parameters: {dict} -- Dict with types settings, column (types) –
-
-
class
spinetoolbox.spine_io.connection_manager.ConnectionWorker(source, connection, parent=None)[source]¶ Bases:
PySide2.QtCore.QObjectA class for delegating SourceConnection operations to another QThread.
Parameters: - source (str) – path of the source file
- connection (class) – A class derived from SourceConnection for connecting to the source file