data_store

Module for data store class.

authors:
  1. Savolainen (VTT), M. Marin (KTH)
date:

18.12.2017

Module Contents

class data_store.DataStore(toolbox, name, description, url, x, y)[source]

Bases: project_item.ProjectItem

Data Store class.

toolbox

QMainWindow instance

Type:ToolboxUI
name

Object name

Type:str
description

Object description

Type:str
url[source]

SQLAlchemy url

Type:str or dict
x

Initial X coordinate of item icon

Type:int
y

Initial Y coordinate of item icon

Type:int
parse_url(self, url)[source]

Return a complete url dictionary from the given dict or string

make_signal_handler_dict(self)[source]

Returns a dictionary of all shared signals and their handlers. This is to enable simpler connecting and disconnecting.

activate(self)[source]

Load url into selections and connect signals.

deactivate(self)[source]

Disconnect signals.

set_url(self, url)[source]

Set url attribute. Used by Tool when passing on results.

url(self)[source]

Return the url attribute, for saving the project.

make_url(self, log_errors=True)[source]

Return a sqlalchemy url from the current url attribute or None if not valid.

project(self)[source]

Returns current project or None if no project open.

get_icon(self)[source]

Returns the item representing this Data Store on the scene.

set_path_to_sqlite_file(self, file_path)[source]

Set path to SQLite file.

open_sqlite_file(self, checked=False)[source]

Open file browser where user can select the path to an SQLite file that they want to use.

load_url_into_selections(self)[source]

Load url attribute into shared widget selections. Used when activating the item, and creating a new Spine db.

refresh_host(self, host='')[source]

Refresh host from selections.

refresh_port(self, port='')[source]

Refresh port from selections.

refresh_database(self, database='')[source]

Refresh database from selections.

refresh_username(self, username='')[source]

Refresh username from selections.

refresh_password(self, password='')[source]

Refresh password from selections.

refresh_dialect(self, dialect='')[source]
enable_no_dialect(self)[source]

Adjust widget enabled status to default when no dialect is selected.

enable_mssql(self)[source]

Adjust controls to mssql connection specification.

enable_sqlite(self)[source]

Adjust controls to sqlite connection specification.

enable_common(self)[source]

Adjust controls to ‘common’ connection specification.

check_dialect(self, dialect)[source]

Check if selected dialect is supported. Offer to install DBAPI if not.

Returns:True if dialect is supported, False if not.
install_dbapi_pip(self, dbapi)[source]

Install DBAPI using pip.

install_dbapi_conda(self, dbapi)[source]

Install DBAPI using conda. Fails if conda is not installed.

open_tree_view(self, checked=False)[source]

Open url in tree view form.

do_open_tree_view(self, db_map)[source]

Open url in tree view form.

tree_view_form_destroyed(self)[source]

Notify that tree view form has been destroyed.

open_graph_view(self, checked=False)[source]

Open url in graph view form.

do_open_graph_view(self, db_map)[source]

Open url in graph view form.

graph_view_form_destroyed(self)[source]

Notify that graph view form has been destroyed.

open_tabular_view(self, checked=False)[source]

Open url in Data Store tabular view.

do_open_tabular_view(self, db_map, database)[source]

Open url in tabular view form.

tabular_view_form_destroyed(self)[source]
open_directory(self, checked=False)[source]

Open file explorer in this Data Store’s data directory.

data_files(self)[source]

Return a list of files that are in this items data directory.

copy_url(self, checked=False)[source]

Copy db url to clipboard.

create_new_spine_database(self, checked=False)[source]

Create new (empty) Spine database.

do_create_new_spine_database(self, url, for_spine_model)[source]

Separate method so ‘busy_effect’ don’t overlay any message box.

update_name_label(self)[source]

Update Data Store tab name label. Used only when renaming project items.

execute(self)[source]

Executes this Data Store.

stop_execution(self)[source]

Stops executing this Data Store.