diff --git a/CHANGELOG.md b/CHANGELOG.md
index 588dd4a..961bf54 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [Unreleased]## [0.5.4.2b]
+## [Unreleased]## [0.5.4.3b]
+### Changed
+
+## [0.5.4.2] - 2022-02-24
+### Changed
+- ScenarioDManager.read_scenario_input_tables_from_db now only returns Inputs (vs the tuple (Inputs,Outputs)). This could cause some backward incompatibility.
+- OptimizationEngine.get_kpi_output_table now returns Dataframe with capitalized column names: 'NAME' and 'VALUE' to make consistent with DO Experiment kpis.
+### Added
+- MapManager.get_tooltip_table to get a tooltip formatted as table
+- ScenarioDbManager.read_multi_scenario_tables_from_db reads multiple scenarios in same DataFrames (for scenario compare feature)
+- ScenarioDbTable.get_sa_column works also on reflected Table, which supports use of cell-updates with a AutoScenarioDbTable
+- ScenarioDbManager._check_schema_name: warns if schema name is mixed case (which is causing problems).
## [0.5.4.1] - 2022-01-24
### Changed
diff --git a/VersioningReadMe.md b/VersioningReadMe.md
index 248f238..415351b 100644
--- a/VersioningReadMe.md
+++ b/VersioningReadMe.md
@@ -11,6 +11,7 @@ Open Terminal (Alt+F12), `cd docs`, run
`make html`
If Powershell:
`cmd.exe /c make html`
+Or first switch to classic cmd using `cmd`.
Note that if you added/removed modules, you first need to re-run the sphinx command:
`sphinx-apidoc -f -o source/ ../dse_do_utils/`
diff --git a/docs/doc_build/doctrees/dse_do_utils.doctree b/docs/doc_build/doctrees/dse_do_utils.doctree
index fe8c3c0..1aa6def 100644
Binary files a/docs/doc_build/doctrees/dse_do_utils.doctree and b/docs/doc_build/doctrees/dse_do_utils.doctree differ
diff --git a/docs/doc_build/doctrees/environment.pickle b/docs/doc_build/doctrees/environment.pickle
index 536f19c..32d3d7f 100644
Binary files a/docs/doc_build/doctrees/environment.pickle and b/docs/doc_build/doctrees/environment.pickle differ
diff --git a/docs/doc_build/html/.buildinfo b/docs/doc_build/html/.buildinfo
index a307fd4..46cbab1 100644
--- a/docs/doc_build/html/.buildinfo
+++ b/docs/doc_build/html/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 11af026b252a6ffaf304856232bb7c3f
+config: e282d28f7964e170cdc546362c13f720
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/doc_build/html/_modules/dse_do_utils.html b/docs/doc_build/html/_modules/dse_do_utils.html
index 6bc8cc7..5ec0f7a 100644
--- a/docs/doc_build/html/_modules/dse_do_utils.html
+++ b/docs/doc_build/html/_modules/dse_do_utils.html
@@ -6,7 +6,7 @@
- dse_do_utils — DSE DO Utils 0.5.4.1 documentation
+ dse_do_utils — DSE DO Utils 0.5.4.2 documentation
@@ -31,7 +31,7 @@
[docs]@staticmethod
+ defget_tooltip_table(rows:List[Tuple[str,str]])->str:
+ """Get a tooltip table, based on the same definition as for `get_popup_table``.
+ Convenience method. Is the same as `MapManager.get_html_table(rows)`.
+ Usage::
+
+ tooltip_table = [
+ ('property_1', 'value_1'),
+ ('property_2', 'value_2'),
+ ]
+ tooltip = MapManager.get_tooltip_table(tooltip_table)
+
+ :param rows: list of tuples with name-value pairs
+
+ :returns (str): text for a tooltip in table format
+ """
+ returnMapManager.get_html_table(rows)
[docs]defget_sa_column(self,db_column_name)->Optional[sqlalchemy.Column]:
- """Returns the SQLAlchemy column with the specified name.
- Dynamically creates a dict/hashtable for more efficient access."""
- # for c in self.columns_metadata:
- # if isinstance(c, sqlalchemy.Column) and c.name == db_column_name:
- # return c
- ifself._sa_column_by_nameisNone:
- self._sa_column_by_name={c.name:cforcinself.columns_metadataifisinstance(c,sqlalchemy.Column)}
- returnself._sa_column_by_name.get(db_column_name)# returns None if npt found (?)
+ """Returns the SQLAlchemy.Column with the specified name.
+ Uses the self.table_metadata (i.e. the sqlalchemy.Table), so works both for pre-defined tables and self-reflected tables like AutoScenarioDbTable
+ """
+ # Grab column directly from sqlalchemy.Table, see https://docs.sqlalchemy.org/en/14/core/metadata.html#accessing-tables-and-columns
+ if(self.table_metadataisnotNone)and(db_column_nameinself.table_metadata.c):
+ returnself.table_metadata.c[db_column_name]
+ else:
+ returnNone
+
+ # # Not 100% sure if this is being called after the potential reflection, so also allow generating the self._sa_column_by_name if length is zero
+ # if self._sa_column_by_name is None or len(self._sa_column_by_name) == 0:
+ # # self._sa_column_by_name = {c.name: c for c in self.columns_metadata if isinstance(c, sqlalchemy.Column)} # Original way: based on self.columns_metadata
+ # self._sa_column_by_name = {c.name: c for c in self.table_metadata.c if isinstance(c, sqlalchemy.Column)} # Works both with normally defined table and reflected table (w. AutoScenarioBdTable)
+ # return self._sa_column_by_name.get(db_column_name) # returns None if npt found (?)
[docs]defcreate_table_metadata(self,metadata,engine,schema,multi_scenario:bool=False)->sqlalchemy.Table:"""If multi_scenario, then add a primary key 'scenario_name'.
@@ -262,9 +268,13 @@
Source code for dse_do_utils.scenariodbmanager
self.engine=engineself.schema=schema
+ # TODO: From the reflected Table, also extract the columns_metadata.
+ # We need that for any DB edits
+
# print(f"create_table_metadata: ")ifengineisnotNone:returnself._reflect_db_table(metadata,engine,schema)
+
returnNone
:param enable_sqlite_fk: If True, enables FK constraint checks in SQLite
"""# WARNING: do NOT use 'OrderedDict[str, ScenarioDbTable]' as type. OrderedDict is not subscriptable. Will cause a syntax error.
- self.schema=schema
+ self.schema=self._check_schema_name(schema)self.multi_scenario=multi_scenario# If true, will add a primary key 'scenario_name' to each tableself.enable_transactions=enable_transactionsself.enable_sqlite_fk=enable_sqlite_fk
@@ -370,6 +380,12 @@
Source code for dse_do_utils.scenariodbmanager
############################################################################################
# Initialization. Called from constructor.############################################################################################
+ def_check_schema_name(self,schema:str):
+ """Checks if schema name is not mixed-case, as this is known to cause issues. Upper-case works well.
+ This is just a warning. It does not change the schema name."""
+ ifnotschema.islower()andnotschema.isupper():## I.e. is mixed_case
+ print(f"Warning: using mixed case in the schema name {schema} may cause unexpected DB errors. Use upper-case only.")
+ returnschemadef_add_scenario_db_table(self,input_db_tables:Dict[str,ScenarioDbTable])->Dict[str,ScenarioDbTable]:"""Adds a Scenario table as the first in the OrderedDict (if it doesn't already exist).
@@ -530,7 +546,10 @@
Source code for dse_do_utils.scenariodbmanager
def _initialize_db_tables_metadata(self):"""To be called from constructor, after engine is 'created'/connected, after self.metadata, self.multi_scenario have been set. This will add the `scenario_name` to the db_table configurations.
- This also allows non-bulk inserts into an existing DB (i.e. without running 'create_schema')"""
+ This also allows non-bulk inserts into an existing DB (i.e. without running 'create_schema')
+
+ TODO: also reflect the columns_metadata. That is required for any table edits
+ """forscenario_table_name,db_tableinself.db_tables.items():db_table.table_metadata=db_table.create_table_metadata(self.metadata,self.engine,
@@ -946,10 +965,13 @@
[docs]defread_scenario_input_tables_from_db(self,scenario_name:str)->Inputs:"""Convenience method to load all input tables.
- Typically used at start if optimization model."""
- returnself.read_scenario_tables_from_db(scenario_name,input_table_names=['*'])
+ Typically used at start if optimization model.
+ :returns The inputs and outputs. (The outputs are always empty.)
+ """
+ inputs,outputs=self.read_scenario_tables_from_db(scenario_name,input_table_names=['*'])
+ returninputs
[docs]defread_multi_scenario_tables_from_db(self,scenario_names:List[str],
+ input_table_names:Optional[List[str]]=None,
+ output_table_names:Optional[List[str]]=None)->(Inputs,Outputs):
+ """Read selected set input and output tables from multiple scenarios.
+ If input_table_names/output_table_names contains a '*', then all input/output tables will be read.
+ If empty list or None, then no tables will be read.
+ """
+ ifself.enable_transactions:
+ withself.engine.begin()asconnection:
+ inputs,outputs=self._read_multi_scenario_tables_from_db(connection,scenario_names,input_table_names,output_table_names)
+ else:
+ inputs,outputs=self._read_multi_scenario_tables_from_db(self.engine,scenario_names,input_table_names,output_table_names)
+ returninputs,outputs
+
+ def_read_multi_scenario_tables_from_db(self,connection,scenario_names:List[str],
+ input_table_names:List[str]=None,
+ output_table_names:List[str]=None)->(Inputs,Outputs):
+ """Loads data for selected input and output tables from multiple scenarios.
+ If either list is names is ['*'], will load all tables as defined in db_tables configuration.
+ """
+ ifinput_table_namesisNone:# load no tables by default
+ input_table_names=[]
+ elif'*'ininput_table_names:
+ input_table_names=list(self.input_db_tables.keys())
+
+ # Add the scenario table
+ if'Scenario'notininput_table_names:
+ input_table_names.append('Scenario')
+
+ ifoutput_table_namesisNone:# load no tables by default
+ output_table_names=[]
+ elif'*'inoutput_table_names:
+ output_table_names=self.output_db_tables.keys()
+
+ inputs={}
+ forscenario_table_name,db_tableinself.input_db_tables.items():
+ ifscenario_table_nameininput_table_names:
+ inputs[scenario_table_name]=self._read_multi_scenario_db_table_from_db(scenario_names,db_table,connection=connection)
+ outputs={}
+ forscenario_table_name,db_tableinself.output_db_tables.items():
+ ifscenario_table_nameinoutput_table_names:
+ outputs[scenario_table_name]=self._read_multi_scenario_db_table_from_db(scenario_names,db_table,connection=connection)
+ returninputs,outputs
+
+ def_read_multi_scenario_db_table_from_db(self,scenario_names:List[str],db_table:ScenarioDbTable,connection)->pd.DataFrame:
+ """Read one table from the DB for multiple scenarios.
+ Does NOT remove the `scenario_name` column.
+ """
+ t:sqlalchemy.Table=db_table.get_sa_table()#table_metadata
+ sql=t.select().where(t.c.scenario_name.in_(scenario_names))# This is NOT a simple string!
+ df=pd.read_sql(sql,con=connection)
+
+ returndf
+
############################################################################################# Update scenario############################################################################################
@@ -1052,6 +1131,7 @@
[docs]defread_scenarios_from_db(self,scenario_names:List[str]=[])->(Inputs,Outputs):
- """Multi scenario load.
+ """DEPRECATED. Multi scenario load. Reads all tables from set of scenarios TODO: avoid use of text SQL. Use SQLAlchemy sql generation. """
@@ -1599,7 +1679,7 @@
Get a tooltip table, based on the same definition as for get_popup_table`.
+Convenience method. Is the same as MapManager.get_html_table(rows).
+Usage:
Read selected set input and output tables from multiple scenarios.
+If input_table_names/output_table_names contains a ‘*’, then all input/output tables will be read.
+If empty list or None, then no tables will be read.
Returns the SQLAlchemy column with the specified name.
-Dynamically creates a dict/hashtable for more efficient access.
+
Returns the SQLAlchemy.Column with the specified name.
+Uses the self.table_metadata (i.e. the sqlalchemy.Table), so works both for pre-defined tables and self-reflected tables like AutoScenarioDbTable
diff --git a/docs/doc_build/html/searchindex.js b/docs/doc_build/html/searchindex.js
index a2abc76..93a1c1a 100644
--- a/docs/doc_build/html/searchindex.js
+++ b/docs/doc_build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["dse_do_utils","index","modules","readme_link"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["dse_do_utils.rst","index.rst","modules.rst","readme_link.rst"],objects:{"":{dse_do_utils:[0,0,0,"-"]},"dse_do_utils.cpd25utilities":{add_file_as_data_asset_cpd25:[0,1,1,""],add_file_path_as_data_asset_cpd25:[0,1,1,""],add_file_path_as_data_asset_wsc:[0,1,1,""],write_data_asset_as_file_cpd25:[0,1,1,""],write_data_asset_as_file_wsc:[0,1,1,""]},"dse_do_utils.datamanager":{DataManager:[0,2,1,""]},"dse_do_utils.datamanager.DataManager":{apply_and_concat:[0,3,1,""],df_crossjoin_ai:[0,3,1,""],df_crossjoin_mi:[0,3,1,""],df_crossjoin_si:[0,3,1,""],extract_solution:[0,3,1,""],get_parameter_value:[0,3,1,""],get_raw_table_by_name:[0,3,1,""],prep_parameters:[0,3,1,""],prepare_data_frames:[0,3,1,""],prepare_input_data_frames:[0,3,1,""],prepare_output_data_frames:[0,3,1,""],print_hello:[0,3,1,""],print_inputs_outputs_summary:[0,3,1,""],set_parameters:[0,3,1,""]},"dse_do_utils.deployeddomodel":{DeployedDOModel:[0,2,1,""]},"dse_do_utils.deployeddomodel.DeployedDOModel":{execute_model:[0,3,1,""],extract_solution:[0,3,1,""],get_deployment_id:[0,3,1,""],get_job_status:[0,3,1,""],get_outputs:[0,3,1,""],get_solve_details:[0,3,1,""],get_solve_details_objective:[0,3,1,""],get_solve_payload:[0,3,1,""],get_solve_status:[0,3,1,""],get_space_id:[0,3,1,""],monitor_execution:[0,3,1,""],solve:[0,3,1,""]},"dse_do_utils.deployeddomodelcpd21":{DeployedDOModel_CPD21:[0,2,1,""]},"dse_do_utils.deployeddomodelcpd21.DeployedDOModel_CPD21":{cleanup:[0,3,1,""],execute_model:[0,3,1,""],get_debug_dump_name_and_url:[0,3,1,""],get_debug_file_url:[0,3,1,""],get_execution_service_model_url:[0,3,1,""],get_execution_status:[0,3,1,""],get_headers:[0,3,1,""],get_input_files:[0,3,1,""],get_job_url:[0,3,1,""],get_kill_job_url:[0,3,1,""],get_log_file_name_and_url:[0,3,1,""],get_log_file_url:[0,3,1,""],get_objective:[0,3,1,""],get_solution_name_and_url:[0,3,1,""],get_solve_config:[0,3,1,""],get_solve_status:[0,3,1,""],get_solve_url:[0,3,1,""],get_stop_job_url:[0,3,1,""],kill_job:[0,3,1,""],monitor_execution:[0,3,1,""],post_process_container:[0,3,1,""],post_process_container_get_dataframe:[0,3,1,""],post_process_failed:[0,3,1,""],post_process_inline_table:[0,3,1,""],post_process_inline_table_get_dataframe:[0,3,1,""],post_process_interrupted:[0,3,1,""],post_process_processed:[0,3,1,""],retrieve_debug_materials:[0,3,1,""],retrieve_file:[0,3,1,""],retrieve_solution:[0,3,1,""],retrieve_solve_configuration:[0,3,1,""],set_output_settings_in_solve_configuration:[0,3,1,""],solve:[0,3,1,""],stop_job:[0,3,1,""]},"dse_do_utils.domodeldeployer":{DOModelDeployer:[0,2,1,""]},"dse_do_utils.domodeldeployer.DOModelDeployer":{create_archive:[0,3,1,""],create_model_archive:[0,3,1,""],create_model_directory:[0,3,1,""],create_package_extension:[0,3,1,""],create_software_specification:[0,3,1,""],deploy_archive:[0,3,1,""],deploy_model:[0,3,1,""],get_scenario:[0,3,1,""],get_wml_create_deployment_meta_props:[0,3,1,""],get_wml_create_store_model_meta_props:[0,3,1,""],guid_from_space_name:[0,3,1,""],wml_create_deployment:[0,3,1,""],wml_store_model:[0,3,1,""],write_main_file:[0,3,1,""],write_yaml_file:[0,3,1,""]},"dse_do_utils.domodelexporter":{DOModelExporter:[0,2,1,""]},"dse_do_utils.domodelexporter.DOModelExporter":{export_do_models:[0,3,1,""],get_access_token_curl:[0,3,1,""],get_access_token_web:[0,3,1,""],get_do_model_export_curl:[0,3,1,""],get_do_model_export_web:[0,3,1,""],get_project_id:[0,3,1,""],write_do_model_to_file:[0,3,1,""]},"dse_do_utils.mapmanager":{MapManager:[0,2,1,""]},"dse_do_utils.mapmanager.MapManager":{add_full_screen:[0,3,1,""],add_layer_control:[0,3,1,""],create_blank_map:[0,3,1,""],get_arrows:[0,3,1,""],get_bearing:[0,3,1,""],get_html_table:[0,3,1,""],get_popup_table:[0,3,1,""],kansas_city_coord:[0,4,1,""]},"dse_do_utils.multiscenariomanager":{MultiScenarioManager:[0,2,1,""]},"dse_do_utils.multiscenariomanager.MultiScenarioManager":{add_data_file_to_project:[0,3,1,""],env_is_wscloud:[0,3,1,""],get_all_scenario_names:[0,3,1,""],get_data_directory:[0,3,1,""],get_dd_client:[0,3,1,""],get_multi_scenario_data:[0,3,1,""],get_root_directory:[0,3,1,""],get_scenarios_df:[0,3,1,""],load_data_from_scenario:[0,3,1,""],merge_scenario_data:[0,3,1,""],write_data_to_excel:[0,3,1,""]},"dse_do_utils.optimizationengine":{MyProgressListener:[0,2,1,""],OptimizationEngine:[0,2,1,""]},"dse_do_utils.optimizationengine.MyProgressListener":{notify_progress:[0,3,1,""]},"dse_do_utils.optimizationengine.OptimizationEngine":{add_mip_progress_kpis:[0,3,1,""],binary_var_series:[0,3,1,""],binary_var_series_s:[0,3,1,""],continuous_var_series:[0,3,1,""],continuous_var_series_s:[0,3,1,""],export_as_cpo:[0,3,1,""],export_as_cpo_s:[0,3,1,""],export_as_lp:[0,3,1,""],export_as_lp_s:[0,3,1,""],get_kpi_output_table:[0,3,1,""],integer_var_series:[0,3,1,""],integer_var_series_s:[0,3,1,""],solve:[0,3,1,""]},"dse_do_utils.plotlymanager":{PlotlyManager:[0,2,1,""]},"dse_do_utils.plotlymanager.PlotlyManager":{get_dash_tab_layout_m:[0,3,1,""],get_plotly_fig_m:[0,3,1,""]},"dse_do_utils.scenariodbmanager":{AutoScenarioDbTable:[0,2,1,""],BusinessKpiTable:[0,2,1,""],DbCellUpdate:[0,2,1,""],KpiTable:[0,2,1,""],ParameterTable:[0,2,1,""],ScenarioDbManager:[0,2,1,""],ScenarioDbTable:[0,2,1,""],ScenarioTable:[0,2,1,""]},"dse_do_utils.scenariodbmanager.AutoScenarioDbTable":{create_table_metadata:[0,3,1,""],get_sa_table:[0,3,1,""],insert_table_in_db_bulk:[0,3,1,""]},"dse_do_utils.scenariodbmanager.DbCellUpdate":{column_name:[0,4,1,""],current_value:[0,4,1,""],previous_value:[0,4,1,""],row_idx:[0,4,1,""],row_index:[0,4,1,""],scenario_name:[0,4,1,""],table_name:[0,4,1,""]},"dse_do_utils.scenariodbmanager.ScenarioDbManager":{add_scenario_name_to_dfs:[0,3,1,""],create_schema:[0,3,1,""],delete_scenario_from_db:[0,3,1,""],delete_scenario_name_column:[0,3,1,""],drop_all_tables:[0,3,1,""],duplicate_scenario_in_db:[0,3,1,""],get_scenario_db_table:[0,3,1,""],get_scenarios_df:[0,3,1,""],insert_scenarios_from_zip:[0,3,1,""],insert_scenarios_in_db:[0,3,1,""],insert_tables_in_db:[0,3,1,""],read_scenario_from_db:[0,3,1,""],read_scenario_input_tables_from_db:[0,3,1,""],read_scenario_table_from_db:[0,3,1,""],read_scenario_table_from_db_cached:[0,3,1,""],read_scenario_tables_from_db:[0,3,1,""],read_scenario_tables_from_db_cached:[0,3,1,""],read_scenarios_from_db:[0,3,1,""],read_scenarios_table_from_db_cached:[0,3,1,""],rename_scenario_in_db:[0,3,1,""],replace_scenario_in_db:[0,3,1,""],replace_scenario_tables_in_db:[0,3,1,""],set_scenarios_table_read_callback:[0,3,1,""],set_table_read_callback:[0,3,1,""],update_cell_changes_in_db:[0,3,1,""],update_scenario_output_tables_in_db:[0,3,1,""]},"dse_do_utils.scenariodbmanager.ScenarioDbTable":{add_scenario_name_to_fk_constraint:[0,3,1,""],camel_case_to_snake_case:[0,3,1,""],create_table_metadata:[0,3,1,""],df_column_names_to_snake_case:[0,3,1,""],get_db_table_name:[0,3,1,""],get_df_column_names:[0,3,1,""],get_sa_column:[0,3,1,""],get_sa_table:[0,3,1,""],insert_table_in_db_bulk:[0,3,1,""],sqlcol:[0,3,1,""]},"dse_do_utils.scenariomanager":{Platform:[0,2,1,""],ScenarioManager:[0,2,1,""]},"dse_do_utils.scenariomanager.Platform":{CPD25:[0,4,1,""],CPD40:[0,4,1,""],CPDaaS:[0,4,1,""],Local:[0,4,1,""]},"dse_do_utils.scenariomanager.ScenarioManager":{add_data_file_to_project_s:[0,3,1,""],add_data_file_using_project_lib:[0,3,1,""],add_data_file_using_ws_lib:[0,3,1,""],add_data_file_using_ws_lib_s:[0,3,1,""],add_data_into_scenario:[0,3,1,""],add_data_into_scenario_s:[0,3,1,""],add_file_as_data_asset:[0,3,1,""],add_file_as_data_asset_s:[0,3,1,""],clear_scenario_data:[0,3,1,""],create_new_scenario:[0,3,1,""],detect_platform:[0,3,1,""],env_is_cpd25:[0,3,1,""],env_is_cpd40:[0,3,1,""],env_is_dsx:[0,3,1,""],env_is_wscloud:[0,3,1,""],export_model_as_lp:[0,3,1,""],get_data_directory:[0,3,1,""],get_dd_client:[0,3,1,""],get_do_scenario:[0,3,1,""],get_kpis_table_as_dataframe:[0,3,1,""],get_root_directory:[0,3,1,""],insert_scenarios_from_zip:[0,3,1,""],load_data:[0,3,1,""],load_data_from_csv:[0,3,1,""],load_data_from_csv_s:[0,3,1,""],load_data_from_excel:[0,3,1,""],load_data_from_excel_s:[0,3,1,""],load_data_from_scenario:[0,3,1,""],load_data_from_scenario_s:[0,3,1,""],print_table_names:[0,3,1,""],replace_data_in_scenario:[0,3,1,""],replace_data_into_scenario_s:[0,3,1,""],update_solve_output_into_scenario:[0,3,1,""],write_data_into_scenario:[0,3,1,""],write_data_into_scenario_s:[0,3,1,""],write_data_to_csv:[0,3,1,""],write_data_to_csv_s:[0,3,1,""],write_data_to_excel:[0,3,1,""],write_data_to_excel_s:[0,3,1,""]},"dse_do_utils.scenariopicker":{ScenarioPicker:[0,2,1,""]},"dse_do_utils.scenariopicker.ScenarioPicker":{ScenarioRefreshButton:[0,2,1,""],default_scenario:[0,4,1,""],get_dd_client:[0,3,1,""],get_scenario_picker_ui:[0,3,1,""],get_scenario_refresh_button:[0,3,1,""],get_scenario_select_drop_down:[0,3,1,""],get_selected_scenario:[0,3,1,""],load_selected_scenario_data:[0,3,1,""],widgets:[0,4,1,""]},"dse_do_utils.utilities":{add_sys_path:[0,1,1,""],list_file_hierarchy:[0,1,1,""]},dse_do_utils:{cpd25utilities:[0,0,0,"-"],datamanager:[0,0,0,"-"],deployeddomodel:[0,0,0,"-"],deployeddomodelcpd21:[0,0,0,"-"],domodeldeployer:[0,0,0,"-"],domodelexporter:[0,0,0,"-"],mapmanager:[0,0,0,"-"],module_reload:[0,1,1,""],multiscenariomanager:[0,0,0,"-"],optimizationengine:[0,0,0,"-"],plotly_cpd_workaround:[0,0,0,"-"],plotlymanager:[0,0,0,"-"],scenariodbmanager:[0,0,0,"-"],scenariomanager:[0,0,0,"-"],scenariopicker:[0,0,0,"-"],utilities:[0,0,0,"-"],version:[0,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"],"2":["py","class","Python class"],"3":["py","method","Python method"],"4":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:function","2":"py:class","3":"py:method","4":"py:attribute"},terms:{"0":[0,1],"01":0,"02ea6d480895":0,"04":0,"0596001673":0,"085594":0,"1":[0,3],"100":0,"1132":0,"16":0,"1993":0,"2":[0,3],"2005586":0,"2016":0,"2022":0,"21":0,"21c8ac71":0,"23690284":0,"25a0fe88e4":0,"26c1":0,"3":[0,3],"31":0,"3810":0,"39":0,"4":[0,3],"41":0,"447a":0,"458550":0,"469":0,"49a5":0,"4bd2":0,"5":[0,1],"50":0,"5401":0,"585241":0,"5de6560a1cfa":0,"6":0,"600":0,"7":3,"785":0,"8021":0,"8364":0,"94":0,"95":0,"96":0,"9f28":0,"abstract":0,"case":[0,3],"class":[0,1],"default":[0,3],"do":0,"enum":0,"export":[0,3],"float":0,"function":[0,3],"import":[0,1],"int":0,"new":0,"return":0,"static":0,"super":0,"true":0,"while":0,A:[0,3],And:0,As:0,At:0,But:[0,3],By:0,FOR:0,For:[0,3],If:0,In:[0,3],Is:0,It:[0,3],NOT:[0,3],No:0,Not:0,On:0,One:0,Or:0,That:0,The:[0,3],Then:[0,3],These:0,To:[0,3],Will:0,With:0,_:0,__index__:0,__init__:0,_base:0,_export_:0,_multi_output:0,_output:0,_table_index_:0,_xlx:0,a567:0,a933:0,aa50:0,abbrevi:0,abc:0,abl:[0,3],about:0,abov:0,abspath:0,accept:0,access:[0,3],access_project_or_spac:0,access_tok:0,access_token:0,accesstoken:0,accordingli:0,ad:[0,3],add:[0,3],add_child:0,add_data_file_to_project:0,add_data_file_to_project_:0,add_data_file_using_project_lib:0,add_data_file_using_ws_lib:0,add_data_file_using_ws_lib_:0,add_data_into_scenario:0,add_data_into_scenario_:0,add_file_as_data_asset:0,add_file_as_data_asset_:0,add_file_as_data_asset_cpd25:0,add_file_path_as_data_asset_cpd25:0,add_file_path_as_data_asset_wsc:0,add_full_screen:0,add_layer_control:0,add_mip_progress_kpi:0,add_scenario_name_to_df:0,add_scenario_name_to_fk_constraint:0,add_sys_path:0,add_to:0,addit:0,advanc:0,advantag:0,advis:0,after:0,air:3,alia:0,all:[0,3],allow:[0,3],along:0,alreadi:0,also:[0,3],altern:0,alwai:0,an:[0,3],ani:0,anoth:0,api:[0,3],apicli:0,app:0,appear:0,appli:[0,3],applic:0,apply_and_concat:0,ar:[0,3],archiv:0,arg:0,argument:0,around:[0,3],arrow:0,asset:[0,3],asset_nam:0,assign:0,assum:0,attach:0,attachment_typ:0,attempt:0,attribut:0,auto_insert:0,autodetect:0,automat:[0,3],autoreload:0,autoscenariodbt:0,avail:[0,3],avoid:[0,3],axi:0,b7bf7fd8:0,back:0,backward:3,base:0,bash:0,basic:3,bear:0,been:[0,3],befor:0,being:0,below:0,best:0,best_bound_kpi_nam:0,better:0,between:[0,3],bewar:0,binary_var_seri:0,binary_var_series_:0,binaryvartyp:0,blank:0,blob:0,blue:0,bobhaffn:0,boilerpl:0,bool:0,both:[0,3],bound:0,box:0,br:0,build:0,builder:[0,1],bulk:0,business_kpi:0,businesskpit:0,button:0,c:0,cach:0,call:0,callback:0,came:0,camel_case_to_snake_cas:0,camelcas:0,can:[0,3],cancel:0,cannot:[0,3],cartesian:0,categor:0,categori:0,caus:0,cell:[0,3],certain:0,certif:0,ch04s23:0,challeng:0,chang:0,channel:3,charact:0,chart:0,check:0,child:0,clean:0,cleanup:0,clear:0,clear_scenario_data:0,client:[0,3],cloud:[0,3],cluster4:0,cluster:0,cluster_nam:0,co:0,code:[0,3],cogno:0,collabor:0,color:0,column:0,column_nam:0,columns_metadata:0,com:0,combin:[0,3],command:0,commun:0,compass:0,compat:[0,3],complet:0,complex:0,compon:0,comput:0,conda:3,condit:0,conf:0,configur:[0,3],connect:[0,3],constant:0,constraints_metadata:0,constructor:0,contain:[0,3],content:2,context:0,continuous_var_seri:0,continuous_var_series_:0,continuousvartyp:0,control:0,conveni:0,convers:0,convert:0,cookbook:0,coord:0,copi:0,copy_to_csv:0,core:0,corner:0,correctli:0,could:0,count:0,counti:0,cp4d25:0,cp4daa:0,cp4dv2:0,cp4dv4:0,cp:[0,3],cpd25:0,cpd25util:2,cpd2:0,cpd3:[0,3],cpd40:0,cpd4:3,cpd:[0,3],cpd_cluster_host:0,cpdaa:0,cpdv2:[0,1],cpdv3:[0,3],cpdv4:[0,1],cplex:[0,3],cpo:0,cpolab:0,cpsaa:0,creat:[0,3],create_arch:0,create_blank_map:0,create_model_arch:0,create_model_directori:0,create_new_scenario:0,create_package_extens:0,create_schema:0,create_software_specif:0,create_table_metadata:0,creation:0,credenti:0,cross:0,crossjoin:3,csv:[0,3],csv_directori:0,csv_name_pattern:0,curl:0,current:0,current_dir:0,current_valu:0,custom:0,d4c69a0d8158:0,d:[0,3],dash:0,dashboard:0,dashenterpris:0,data:[0,3],data_asset:[0,3],data_by_scenario:0,data_id:0,data_manag:0,data_url:0,datafram:0,datamanag:[2,3],datascienceelit:0,dataset:0,datetim:0,db:0,db_cell_upd:0,db_column_nam:0,db_table_nam:0,dbcellupd:0,dd:[0,3],dd_scenario:0,de:0,debug:0,debug_file_data_url:0,debug_file_dir:0,decis:3,decision_optimization_cli:0,def:0,default_max_oaas_time_limit_sec:0,default_max_run_time_sec:0,default_scenario:0,default_valu:0,defin:0,definit:0,delai:0,delet:0,delete_scenario_from_db:0,delete_scenario_name_column:0,depend:[0,3],deploi:0,deploy:[0,3],deploy_arch:0,deploy_model:0,deployed_model_nam:0,deployeddomodel:2,deployeddomodel_cpd21:0,deployeddomodelcpd21:2,deployment_descript:0,deployment_id:0,deployment_nam:0,deployment_uid:0,deprec:0,design:[0,3],despit:0,detail:3,detect_platform:0,develop:[0,3],df1:0,df2:0,df:0,df_column_names_to_snake_cas:0,df_crossjoin_ai:0,df_crossjoin_mi:0,df_crossjoin_si:0,df_dict:0,dict:0,dictionari:0,differ:[0,3],direct:0,directori:0,disadvantag:0,disk:0,dm:0,do4w:0,do_model_nam:0,do_util:0,doc:0,docplex:[0,3],document:[0,3],dodashapp:0,doe:0,doesn:0,domodeldeploy:2,domodelexport:2,done:0,down:[0,3],download:[0,3],driven:0,drop:[0,3],drop_all_t:0,drop_column_nam:0,dropdown:0,dse:[0,3],dse_do_dashboard:0,dse_do_util:1,dsx:0,dsx_project_dir:0,dsxuser:0,due:0,dump:0,dumpzipnam:0,duplic:0,duplicate_scenario_in_db:0,dure:0,dvar:[0,3],dynam:0,e:[0,3],each:0,easi:[0,3],easier:0,easili:0,echo:0,ef365b2c:0,effect:0,effici:0,eg:0,either:0,element:0,els:0,emb:0,empti:[0,3],en:0,enabl:0,enable_sqlite_fk:0,enable_transact:0,end:0,engin:[0,3],ensur:0,entiti:0,entri:0,enumer:0,env_is_cpd25:0,env_is_cpd40:0,env_is_dsx:0,env_is_wscloud:0,environ:[0,1],error:0,establish:0,evalu:0,exampl:0,excel:[0,3],excel_file_nam:0,excel_output_file_nam:0,excel_test:0,excelfil:0,excelwrit:0,except:0,exclud:0,execut:0,execute_model:0,execution_result:0,execution_statu:0,execution_status_json:0,exist:[0,3],expect:0,experi:0,explicit:0,explicitli:0,export_as_cpo:0,export_as_cpo_:0,export_as_lp:0,export_as_lp_:0,export_do_model:0,export_model:0,export_model_as_lp:0,expos:0,express:0,extend:0,extended_columns_metadata:0,extens:0,extract:0,extract_dvar_nam:0,extract_solut:0,f:0,fail:0,fake:3,fals:0,faster:0,featur:3,featuregroup:0,field:0,fig:0,file:[0,3],file_nam:0,file_path:0,filenam:0,filepath:0,filter:0,find:0,firefox:0,first:0,fix:0,fkc:0,flask:0,folder:0,folium:[0,3],follow:[0,3],footer:0,forc:0,foreign:0,foreignkeyconstraint:0,form:0,format:0,former:[0,3],found:0,frame:0,free:0,from:[0,3],full:0,full_project_nam:0,func:0,futur:[0,3],g:[0,3],gap:[0,3],gener:0,get:0,get_access_token_curl:0,get_access_token_web:0,get_all_scenario_nam:0,get_arrow:0,get_bear:0,get_dash_tab_layout_m:0,get_data_directori:0,get_db_table_nam:0,get_dd_client:0,get_debug_dump_name_and_url:0,get_debug_file_url:0,get_deployment_id:0,get_df_column_nam:0,get_do_model_export_curl:0,get_do_model_export_web:0,get_do_scenario:0,get_execution_service_model_url:0,get_execution_statu:0,get_head:0,get_html_tabl:0,get_input_fil:0,get_job_statu:0,get_job_url:0,get_kill_job_url:0,get_kpi_output_t:0,get_kpis_table_as_datafram:0,get_log_file_name_and_url:0,get_log_file_url:0,get_multi_scenario_data:0,get_object:0,get_output:0,get_parameter_valu:0,get_plotly_fig_m:0,get_popup_t:0,get_project_id:0,get_raw_table_by_nam:0,get_root_directori:0,get_sa_column:0,get_sa_t:0,get_scenario:0,get_scenario_db_t:0,get_scenario_picker_ui:0,get_scenario_refresh_button:0,get_scenario_select_drop_down:0,get_scenarios_df:0,get_selected_scenario:0,get_solution_name_and_url:0,get_solve_config:0,get_solve_detail:0,get_solve_details_object:0,get_solve_payload:0,get_solve_statu:0,get_solve_url:0,get_space_id:0,get_stop_job_url:0,get_tab_layout_:0,get_wml_create_deployment_meta_prop:0,get_wml_create_store_model_meta_prop:0,getcwd:0,gist:0,git:0,github:[0,3],githubpag:3,give:0,given:0,glob:0,grand:0,greatli:3,gsilabs_scnfo:0,guid_from_space_nam:0,h:0,ha:[0,3],hack:3,hand:0,handl:0,happen:0,hard:0,hashtabl:0,have:[0,3],header:0,height:0,hello:0,here:0,hierarch:0,hold:0,home:0,how:[0,3],howev:0,html:0,http:0,hypothet:0,i:0,ibm:[0,3],ibm_watson_machine_learn:0,ibm_watson_studio_lib:0,icon:0,icpd:3,id:0,ignor:[0,3],imp:0,impact:3,implement:0,improv:[0,3],includ:0,inconsist:0,incorrect:0,independ:0,index:[0,1],indic:0,individu:[0,3],info:0,inform:0,init:0,initi:0,inline_t:0,inner:0,input:0,input_csv_name_pattern:0,input_db_t:0,input_table_nam:0,insecurerequestwarn:0,insert:0,insert_scenarios_from_zip:0,insert_scenarios_in_db:0,insert_table_in_db_bulk:0,insert_tables_in_db:0,instal:[0,1],installationreadm:3,instanc:0,instead:0,integ:0,integer_var_list:0,integer_var_seri:0,integer_var_series_:0,integervartyp:0,intend:3,interact:[0,3],interfac:3,intermedi:0,intern:[0,3],internet:3,interrupt:0,interv:0,io:0,ipynb:0,ipywidget:0,issu:0,itself:3,jerom:0,job:0,job_config_json:0,job_detail:0,job_uid:0,join:0,json:0,jupyt:[0,3],jupyterlab:3,just:0,kansas_city_coord:0,karg:0,keep:0,kei:0,keyword:0,kill:0,kill_job:0,km:0,kpi:0,kpitabl:0,kwarg:0,lambda:0,last:0,lat:0,later:0,latest:0,layer_control_posit:0,lead:0,leav:0,left:0,let:0,level:0,lib:0,librari:0,like:[0,3],limit:[0,3],line:0,list:0,list_file_hierarchi:0,load:0,load_data:0,load_data_from_csv:0,load_data_from_csv_:0,load_data_from_excel:0,load_data_from_excel_:0,load_data_from_scenario:0,load_data_from_scenario_:0,load_from_excel:0,load_selected_scenario_data:0,local:[0,3],local_root:0,locat:0,log:0,log_file_nam:0,logic:0,lon:0,longer:[0,3],look:0,loop:0,lp:[0,3],m:0,machin:0,made:0,mai:0,main:[0,1],main_file_path:0,maintain:0,major:0,make:0,manag:0,mani:3,manipul:[0,3],manual:0,map:[0,3],mapmanag:[2,3],marker:0,master:0,match:0,max_oaas_time_limit_sec:0,max_run_time_sec:0,maximum:0,mb:3,md:[0,3],mdl:0,me:[0,1],mean:0,medium:0,member:0,menu:[0,3],merg:0,merge_scenario_data:0,messag:0,meta_prop:0,metadata:0,method:0,mgr:0,might:3,minu:0,mip_gap_kpi_nam:0,miss:0,mix:0,mkonrad:0,mode:0,model1:0,model2:0,model:[0,1],model_archive_file_path:0,model_build:0,model_nam:0,model_uid:0,modelbuild:0,modifi:0,modul:[1,2],module_reload:0,moment:3,monitor:0,monitor_execut:0,monitor_loop_delay_sec:0,more:[0,3],most:0,mostli:3,move:3,mp:0,msm:0,multi:0,multi_scenario:0,multi_thread:0,multiindex:0,multipl:[0,3],multiscenariomanag:2,must:0,my:0,my_default_scenario:0,my_do_model:0,my_funct:0,my_input_column_nam:0,my_input_valu:0,my_output_column_name_1:0,my_output_column_name_2:0,my_output_value1:0,my_output_value_1:0,my_output_value_2:0,my_tabl:0,myexcelfil:0,myexcelfileoutput:0,myfil:0,mymodel:0,myoptimizationengin:0,myprogresslisten:0,mytabl:0,n:0,n_arrow:0,name:0,namedtupl:0,nbviewer:0,necessari:0,need:0,neither:3,net:0,never:0,new_path:0,new_scenario_nam:0,next:0,nodefault:3,non:0,none:0,not_start:0,note:[0,3],notebook:[0,3],notify_progress:0,now:0,number:0,oaa:0,object:0,off:0,ok:0,omit:0,onc:0,one:0,ones:0,onli:[0,3],open:0,oper:0,optim:[0,3],optimizationengin:[2,3],option:[0,3],order:0,ordereddict:0,ore:3,oreilli:0,org:0,organ:0,origin:0,os:0,other:[0,3],otherwis:0,out:0,output:0,output_csv_name_pattern:0,output_db_t:0,output_table_nam:0,outsid:3,overrid:0,overridden:0,overwrit:0,overwritten:0,p1:0,p2:0,packag:[1,2,3],package_path:0,page:[0,1],page_id:0,page_sourc:0,pak:3,panda:0,panel:0,param:0,param_nam:0,param_typ:0,paramet:0,parametert:0,pardir:0,parent:0,parent_dir:0,parent_dir_2:0,pars:0,parse_html:0,part:0,particular:[0,3],pass:0,password:0,past:0,path:0,pattern:0,payload:0,pd:0,per:0,perform:[0,3],period:0,person:0,phase:0,pick:3,picker:0,pip:[0,3],pkg_ext_id:0,place:0,placehold:0,plain:0,platform:0,plot:0,plotli:0,plotly_cpd_workaround:2,plotlymanag:2,plugin:0,point:0,poll:0,polylin:0,popul:0,popup:0,popup_t:0,possibl:0,post:[0,3],post_process_contain:0,post_process_container_get_datafram:0,post_process_fail:0,post_process_inline_t:0,post_process_inline_table_get_datafram:0,post_process_interrupt:0,post_process_process:0,practic:0,pre:[0,3],prefer:3,prep_paramet:0,prepar:0,prepare_data_fram:0,prepare_input_data_fram:0,prepare_output_data_fram:0,prevent:0,previou:3,previous_valu:0,primari:0,print:0,print_hello:0,print_inputs_outputs_summari:0,print_table_nam:0,problem:0,procedur:0,process:[0,3],product:0,productionplan:0,progress:0,progress_data:0,progressdata:0,project:[0,3],project_access_token:0,project_data:[0,3],project_id:0,project_lib:0,project_nam:0,properti:0,property_1:0,property_2:0,provid:[0,3],put:3,pwd:0,py:0,pydata:0,pypi:3,python:[0,3],question:0,queu:0,quot:0,rais:0,raw:0,re:0,reach:0,read:[0,1],read_csv:0,read_scenario_from_db:0,read_scenario_input_tables_from_db:0,read_scenario_table_from_db:0,read_scenario_table_from_db_cach:0,read_scenario_table_from_db_callback:0,read_scenario_tables_from_db:0,read_scenario_tables_from_db_cach:0,read_scenarios_from_db:0,read_scenarios_table_from_db_cach:0,read_scenarios_table_from_db_callback:0,readthedoc:0,reason:0,record:0,reduc:0,refactor:3,refer:0,refine_conflict:0,reflect:0,refresh:0,regist:0,regular:0,regularli:[0,3],rel:0,relat:0,relationship:0,releas:3,relev:0,reliabl:0,reload:0,remot:0,remov:0,renam:0,rename_scenario_in_db:0,repeatedli:0,replac:0,replace_data_in_scenario:0,replace_data_into_scenario_:0,replace_scenario_in_db:0,replace_scenario_tables_in_db:0,repositori:3,repres:0,represent:0,request:0,requir:[0,1],rerun:0,resourc:0,respons:0,rest:0,restor:0,restrict:0,result:0,retreiv:0,retriev:0,retrieve_debug_materi:0,retrieve_fil:0,retrieve_solut:0,retrieve_solve_configur:0,right:0,root:0,root_dir:0,rotat:0,round:0,rout:0,routin:0,row:0,row_idx:0,row_index:0,run:[0,3],runtime_env_apsx_url:0,s:0,same:[0,3],save:0,scenario:[0,3],scenario_1:0,scenario_nam:0,scenario_table_nam:0,scenariodbmanag:2,scenariodbt:0,scenariomanag:[2,3],scenariopick:[2,3],scenariorefreshbutton:0,scenarios_table_read_callback:0,scenariot:0,schema:0,scnfo:0,scnfo_dash_pycharm_github:0,scope:1,screen:0,script:3,search:[0,1],second:0,see:[0,3],seem:0,select:0,self:0,separ:[0,3],sequenc:0,seri:0,server:0,servic:0,service_configuration_json:0,service_nam:0,set:0,set_index:0,set_output_settings_in_solve_configur:0,set_paramet:0,set_scenarios_table_read_callback:0,set_table_read_callback:0,setup:0,share:3,sheet:0,should:[0,3],show:0,side:0,signific:3,similar:0,simpl:0,simplenamespac:0,simplest:0,simpli:0,sinc:0,singl:0,site:0,size:0,skip:0,sm:0,small:0,snake_cas:0,so:0,solut:0,solution_count_kpi_nam:0,solutionlisten:0,solv:0,solve_config:0,solve_config_json:0,solve_payload:0,solve_phase_kpi_nam:0,solve_statu:0,solve_time_kpi_nam:0,solvesolut:0,some:[0,3],someth:0,somewhat:0,sourc:[0,3],source_scenario_nam:0,sp:0,space:0,space_id:0,space_nam:0,spd:0,specifi:0,speed:0,spreadhseet:3,spreadsheet:0,sql:0,sqlalchemi:0,sqlcol:0,ssl:0,stackoverflow:0,stamp:0,standard:0,start:0,startpath:0,state:0,statement:0,statu:0,step:0,stop:0,stop_job:0,storag:0,store:[0,3],str:0,strftime:0,string:0,strongli:0,structur:0,studio:[0,3],sub:0,subclass:[0,3],submiss:0,submodul:2,succesfulli:0,suffici:0,suggest:0,summari:0,support:0,suppress:0,suppress_warn:0,sure:0,surround:0,sw_spec_id:0,sy:0,system:[0,3],t:0,tabl:[0,3],table_index_sheet:0,table_nam:0,table_read_callback:0,target:[0,1],target_scenario_nam:0,task:0,templat:0,template_scenario_nam:0,temporari:0,termin:0,test:0,text:0,than:0,thei:0,them:0,therebi:0,therefor:[0,3],thi:[0,3],thing:0,those:0,thu:0,time:0,time_limit:0,tmp_dir:0,todo:0,token:0,tooltip:0,top:0,topleft:0,touch:0,track:0,transact:0,translat:0,tree:0,truth:0,tupl:0,turn:0,two:0,txt:0,type:0,typic:[0,3],ugli:0,ui:0,uid:0,un:0,under:0,unfortun:0,uniqu:0,unknown:0,unnam:0,untest:0,unverifi:0,up:[0,3],updat:0,update_cell_changes_in_db:0,update_scenario_output_tables_in_db:0,update_solve_output_into_scenario:0,upload:[0,3],url:0,urllib3:0,us:[0,3],usag:[0,3],user:0,user_access_token:0,user_nam:0,util:[2,3],v0:3,v2:3,v4:3,valid:0,valu:0,value_1:0,value_2:0,value_format:0,valueerror:0,variabl:0,venv:0,veri:3,verif:0,verifi:0,verify_integr:0,version:[2,3],via:0,view:0,visibl:0,visual:[0,3],vt:0,w:0,wa:0,wai:0,want:0,warn:0,watson:[0,3],watsonmachinelearningapicli:0,we:0,web:0,well:0,what:0,whatev:0,wheel:3,when:[0,3],where:0,which:0,whole:0,widget:0,widget_button:0,widget_select:0,width:0,wil:0,window:0,within:[0,3],without:0,wml:[0,1],wml_create_deploy:0,wml_credenti:0,wml_store_model:0,work:[0,3],world:0,would:0,write:[0,3],write_data_asset_as_file_cpd25:0,write_data_asset_as_file_wsc:0,write_data_into_scenario:0,write_data_into_scenario_:0,write_data_to_csv:0,write_data_to_csv_:0,write_data_to_excel:0,write_data_to_excel_:0,write_do_model_to_fil:0,write_main_fil:0,write_yaml_fil:0,writer:0,written:0,ws:[0,3],wsl1:0,wsl:[0,3],wslib:0,wslv1:3,wsuser:0,www:0,xdvar:0,xl:0,xlsx:0,xlx:0,xxx:0,xxxxxx:0,y:0,yaml_file_path:0,yet:0,yml:0,you:0,your:0,yyyymmdd_hhmm:0,zip:[0,3],zoom_start:0},titles:["dse_do_utils package","Welcome to DSE DO Utils documentation!","dse_do_utils","Read me"],titleterms:{"0":3,"5":3,"class":3,"do":[1,3],"import":3,builder:3,content:[0,1],cpd25util:0,cpdv2:3,cpdv4:3,custom:3,datamanag:0,deployeddomodel:0,deployeddomodelcpd21:0,document:1,domodeldeploy:0,domodelexport:0,dse:1,dse_do_util:[0,2,3],environ:3,indic:1,instal:3,main:3,mapmanag:0,me:3,model:3,modul:[0,3],multiscenariomanag:0,optimizationengin:0,packag:0,plotly_cpd_workaround:0,plotlymanag:0,read:3,requir:3,scenariodbmanag:0,scenariomanag:0,scenariopick:0,scope:3,submodul:0,tabl:1,target:3,util:[0,1],version:0,welcom:1,wml:3}})
\ No newline at end of file
+Search.setIndex({docnames:["dse_do_utils","index","modules","readme_link"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["dse_do_utils.rst","index.rst","modules.rst","readme_link.rst"],objects:{"":{dse_do_utils:[0,0,0,"-"]},"dse_do_utils.cpd25utilities":{add_file_as_data_asset_cpd25:[0,1,1,""],add_file_path_as_data_asset_cpd25:[0,1,1,""],add_file_path_as_data_asset_wsc:[0,1,1,""],write_data_asset_as_file_cpd25:[0,1,1,""],write_data_asset_as_file_wsc:[0,1,1,""]},"dse_do_utils.datamanager":{DataManager:[0,2,1,""]},"dse_do_utils.datamanager.DataManager":{apply_and_concat:[0,3,1,""],df_crossjoin_ai:[0,3,1,""],df_crossjoin_mi:[0,3,1,""],df_crossjoin_si:[0,3,1,""],extract_solution:[0,3,1,""],get_parameter_value:[0,3,1,""],get_raw_table_by_name:[0,3,1,""],prep_parameters:[0,3,1,""],prepare_data_frames:[0,3,1,""],prepare_input_data_frames:[0,3,1,""],prepare_output_data_frames:[0,3,1,""],print_hello:[0,3,1,""],print_inputs_outputs_summary:[0,3,1,""],set_parameters:[0,3,1,""]},"dse_do_utils.deployeddomodel":{DeployedDOModel:[0,2,1,""]},"dse_do_utils.deployeddomodel.DeployedDOModel":{execute_model:[0,3,1,""],extract_solution:[0,3,1,""],get_deployment_id:[0,3,1,""],get_job_status:[0,3,1,""],get_outputs:[0,3,1,""],get_solve_details:[0,3,1,""],get_solve_details_objective:[0,3,1,""],get_solve_payload:[0,3,1,""],get_solve_status:[0,3,1,""],get_space_id:[0,3,1,""],monitor_execution:[0,3,1,""],solve:[0,3,1,""]},"dse_do_utils.deployeddomodelcpd21":{DeployedDOModel_CPD21:[0,2,1,""]},"dse_do_utils.deployeddomodelcpd21.DeployedDOModel_CPD21":{cleanup:[0,3,1,""],execute_model:[0,3,1,""],get_debug_dump_name_and_url:[0,3,1,""],get_debug_file_url:[0,3,1,""],get_execution_service_model_url:[0,3,1,""],get_execution_status:[0,3,1,""],get_headers:[0,3,1,""],get_input_files:[0,3,1,""],get_job_url:[0,3,1,""],get_kill_job_url:[0,3,1,""],get_log_file_name_and_url:[0,3,1,""],get_log_file_url:[0,3,1,""],get_objective:[0,3,1,""],get_solution_name_and_url:[0,3,1,""],get_solve_config:[0,3,1,""],get_solve_status:[0,3,1,""],get_solve_url:[0,3,1,""],get_stop_job_url:[0,3,1,""],kill_job:[0,3,1,""],monitor_execution:[0,3,1,""],post_process_container:[0,3,1,""],post_process_container_get_dataframe:[0,3,1,""],post_process_failed:[0,3,1,""],post_process_inline_table:[0,3,1,""],post_process_inline_table_get_dataframe:[0,3,1,""],post_process_interrupted:[0,3,1,""],post_process_processed:[0,3,1,""],retrieve_debug_materials:[0,3,1,""],retrieve_file:[0,3,1,""],retrieve_solution:[0,3,1,""],retrieve_solve_configuration:[0,3,1,""],set_output_settings_in_solve_configuration:[0,3,1,""],solve:[0,3,1,""],stop_job:[0,3,1,""]},"dse_do_utils.domodeldeployer":{DOModelDeployer:[0,2,1,""]},"dse_do_utils.domodeldeployer.DOModelDeployer":{create_archive:[0,3,1,""],create_model_archive:[0,3,1,""],create_model_directory:[0,3,1,""],create_package_extension:[0,3,1,""],create_software_specification:[0,3,1,""],deploy_archive:[0,3,1,""],deploy_model:[0,3,1,""],get_scenario:[0,3,1,""],get_wml_create_deployment_meta_props:[0,3,1,""],get_wml_create_store_model_meta_props:[0,3,1,""],guid_from_space_name:[0,3,1,""],wml_create_deployment:[0,3,1,""],wml_store_model:[0,3,1,""],write_main_file:[0,3,1,""],write_yaml_file:[0,3,1,""]},"dse_do_utils.domodelexporter":{DOModelExporter:[0,2,1,""]},"dse_do_utils.domodelexporter.DOModelExporter":{export_do_models:[0,3,1,""],get_access_token_curl:[0,3,1,""],get_access_token_web:[0,3,1,""],get_do_model_export_curl:[0,3,1,""],get_do_model_export_web:[0,3,1,""],get_project_id:[0,3,1,""],write_do_model_to_file:[0,3,1,""]},"dse_do_utils.mapmanager":{MapManager:[0,2,1,""]},"dse_do_utils.mapmanager.MapManager":{add_full_screen:[0,3,1,""],add_layer_control:[0,3,1,""],create_blank_map:[0,3,1,""],get_arrows:[0,3,1,""],get_bearing:[0,3,1,""],get_html_table:[0,3,1,""],get_popup_table:[0,3,1,""],get_tooltip_table:[0,3,1,""],kansas_city_coord:[0,4,1,""]},"dse_do_utils.multiscenariomanager":{MultiScenarioManager:[0,2,1,""]},"dse_do_utils.multiscenariomanager.MultiScenarioManager":{add_data_file_to_project:[0,3,1,""],env_is_wscloud:[0,3,1,""],get_all_scenario_names:[0,3,1,""],get_data_directory:[0,3,1,""],get_dd_client:[0,3,1,""],get_multi_scenario_data:[0,3,1,""],get_root_directory:[0,3,1,""],get_scenarios_df:[0,3,1,""],load_data_from_scenario:[0,3,1,""],merge_scenario_data:[0,3,1,""],write_data_to_excel:[0,3,1,""]},"dse_do_utils.optimizationengine":{MyProgressListener:[0,2,1,""],OptimizationEngine:[0,2,1,""]},"dse_do_utils.optimizationengine.MyProgressListener":{notify_progress:[0,3,1,""]},"dse_do_utils.optimizationengine.OptimizationEngine":{add_mip_progress_kpis:[0,3,1,""],binary_var_series:[0,3,1,""],binary_var_series_s:[0,3,1,""],continuous_var_series:[0,3,1,""],continuous_var_series_s:[0,3,1,""],export_as_cpo:[0,3,1,""],export_as_cpo_s:[0,3,1,""],export_as_lp:[0,3,1,""],export_as_lp_s:[0,3,1,""],get_kpi_output_table:[0,3,1,""],integer_var_series:[0,3,1,""],integer_var_series_s:[0,3,1,""],solve:[0,3,1,""]},"dse_do_utils.plotlymanager":{PlotlyManager:[0,2,1,""]},"dse_do_utils.plotlymanager.PlotlyManager":{get_dash_tab_layout_m:[0,3,1,""],get_plotly_fig_m:[0,3,1,""]},"dse_do_utils.scenariodbmanager":{AutoScenarioDbTable:[0,2,1,""],BusinessKpiTable:[0,2,1,""],DbCellUpdate:[0,2,1,""],KpiTable:[0,2,1,""],ParameterTable:[0,2,1,""],ScenarioDbManager:[0,2,1,""],ScenarioDbTable:[0,2,1,""],ScenarioTable:[0,2,1,""]},"dse_do_utils.scenariodbmanager.AutoScenarioDbTable":{create_table_metadata:[0,3,1,""],get_sa_table:[0,3,1,""],insert_table_in_db_bulk:[0,3,1,""]},"dse_do_utils.scenariodbmanager.DbCellUpdate":{column_name:[0,4,1,""],current_value:[0,4,1,""],previous_value:[0,4,1,""],row_idx:[0,4,1,""],row_index:[0,4,1,""],scenario_name:[0,4,1,""],table_name:[0,4,1,""]},"dse_do_utils.scenariodbmanager.ScenarioDbManager":{add_scenario_name_to_dfs:[0,3,1,""],create_schema:[0,3,1,""],delete_scenario_from_db:[0,3,1,""],delete_scenario_name_column:[0,3,1,""],drop_all_tables:[0,3,1,""],duplicate_scenario_in_db:[0,3,1,""],get_scenario_db_table:[0,3,1,""],get_scenarios_df:[0,3,1,""],insert_scenarios_from_zip:[0,3,1,""],insert_scenarios_in_db:[0,3,1,""],insert_tables_in_db:[0,3,1,""],read_multi_scenario_tables_from_db:[0,3,1,""],read_scenario_from_db:[0,3,1,""],read_scenario_input_tables_from_db:[0,3,1,""],read_scenario_table_from_db:[0,3,1,""],read_scenario_table_from_db_cached:[0,3,1,""],read_scenario_tables_from_db:[0,3,1,""],read_scenario_tables_from_db_cached:[0,3,1,""],read_scenarios_from_db:[0,3,1,""],read_scenarios_table_from_db_cached:[0,3,1,""],rename_scenario_in_db:[0,3,1,""],replace_scenario_in_db:[0,3,1,""],replace_scenario_tables_in_db:[0,3,1,""],set_scenarios_table_read_callback:[0,3,1,""],set_table_read_callback:[0,3,1,""],update_cell_changes_in_db:[0,3,1,""],update_scenario_output_tables_in_db:[0,3,1,""]},"dse_do_utils.scenariodbmanager.ScenarioDbTable":{add_scenario_name_to_fk_constraint:[0,3,1,""],camel_case_to_snake_case:[0,3,1,""],create_table_metadata:[0,3,1,""],df_column_names_to_snake_case:[0,3,1,""],get_db_table_name:[0,3,1,""],get_df_column_names:[0,3,1,""],get_sa_column:[0,3,1,""],get_sa_table:[0,3,1,""],insert_table_in_db_bulk:[0,3,1,""],sqlcol:[0,3,1,""]},"dse_do_utils.scenariomanager":{Platform:[0,2,1,""],ScenarioManager:[0,2,1,""]},"dse_do_utils.scenariomanager.Platform":{CPD25:[0,4,1,""],CPD40:[0,4,1,""],CPDaaS:[0,4,1,""],Local:[0,4,1,""]},"dse_do_utils.scenariomanager.ScenarioManager":{add_data_file_to_project_s:[0,3,1,""],add_data_file_using_project_lib:[0,3,1,""],add_data_file_using_ws_lib:[0,3,1,""],add_data_file_using_ws_lib_s:[0,3,1,""],add_data_into_scenario:[0,3,1,""],add_data_into_scenario_s:[0,3,1,""],add_file_as_data_asset:[0,3,1,""],add_file_as_data_asset_s:[0,3,1,""],clear_scenario_data:[0,3,1,""],create_new_scenario:[0,3,1,""],detect_platform:[0,3,1,""],env_is_cpd25:[0,3,1,""],env_is_cpd40:[0,3,1,""],env_is_dsx:[0,3,1,""],env_is_wscloud:[0,3,1,""],export_model_as_lp:[0,3,1,""],get_data_directory:[0,3,1,""],get_dd_client:[0,3,1,""],get_do_scenario:[0,3,1,""],get_kpis_table_as_dataframe:[0,3,1,""],get_root_directory:[0,3,1,""],insert_scenarios_from_zip:[0,3,1,""],load_data:[0,3,1,""],load_data_from_csv:[0,3,1,""],load_data_from_csv_s:[0,3,1,""],load_data_from_excel:[0,3,1,""],load_data_from_excel_s:[0,3,1,""],load_data_from_scenario:[0,3,1,""],load_data_from_scenario_s:[0,3,1,""],print_table_names:[0,3,1,""],replace_data_in_scenario:[0,3,1,""],replace_data_into_scenario_s:[0,3,1,""],update_solve_output_into_scenario:[0,3,1,""],write_data_into_scenario:[0,3,1,""],write_data_into_scenario_s:[0,3,1,""],write_data_to_csv:[0,3,1,""],write_data_to_csv_s:[0,3,1,""],write_data_to_excel:[0,3,1,""],write_data_to_excel_s:[0,3,1,""]},"dse_do_utils.scenariopicker":{ScenarioPicker:[0,2,1,""]},"dse_do_utils.scenariopicker.ScenarioPicker":{ScenarioRefreshButton:[0,2,1,""],default_scenario:[0,4,1,""],get_dd_client:[0,3,1,""],get_scenario_picker_ui:[0,3,1,""],get_scenario_refresh_button:[0,3,1,""],get_scenario_select_drop_down:[0,3,1,""],get_selected_scenario:[0,3,1,""],load_selected_scenario_data:[0,3,1,""],widgets:[0,4,1,""]},"dse_do_utils.utilities":{add_sys_path:[0,1,1,""],list_file_hierarchy:[0,1,1,""]},dse_do_utils:{cpd25utilities:[0,0,0,"-"],datamanager:[0,0,0,"-"],deployeddomodel:[0,0,0,"-"],deployeddomodelcpd21:[0,0,0,"-"],domodeldeployer:[0,0,0,"-"],domodelexporter:[0,0,0,"-"],mapmanager:[0,0,0,"-"],module_reload:[0,1,1,""],multiscenariomanager:[0,0,0,"-"],optimizationengine:[0,0,0,"-"],plotly_cpd_workaround:[0,0,0,"-"],plotlymanager:[0,0,0,"-"],scenariodbmanager:[0,0,0,"-"],scenariomanager:[0,0,0,"-"],scenariopicker:[0,0,0,"-"],utilities:[0,0,0,"-"],version:[0,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"],"2":["py","class","Python class"],"3":["py","method","Python method"],"4":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:function","2":"py:class","3":"py:method","4":"py:attribute"},terms:{"0":[0,1],"01":0,"02ea6d480895":0,"04":0,"0596001673":0,"085594":0,"1":[0,3],"100":0,"1132":0,"16":0,"1993":0,"2":[0,3],"2005586":0,"2016":0,"2022":0,"21":0,"21c8ac71":0,"23690284":0,"25a0fe88e4":0,"26c1":0,"3":[0,3],"31":0,"3810":0,"39":0,"4":[0,3],"41":0,"447a":0,"458550":0,"469":0,"49a5":0,"4bd2":0,"5":[0,1],"50":0,"5401":0,"585241":0,"5de6560a1cfa":0,"6":0,"600":0,"7":3,"785":0,"8021":0,"8364":0,"94":0,"95":0,"96":0,"9f28":0,"abstract":0,"case":[0,3],"class":[0,1],"default":[0,3],"do":0,"enum":0,"export":[0,3],"float":0,"function":[0,3],"import":[0,1],"int":0,"new":0,"return":0,"static":0,"super":0,"true":0,"while":0,A:[0,3],And:0,As:0,At:0,But:[0,3],By:0,FOR:0,For:[0,3],If:0,In:[0,3],Is:0,It:[0,3],NOT:[0,3],No:0,Not:0,On:0,One:0,Or:0,That:0,The:[0,3],Then:[0,3],These:0,To:[0,3],Will:0,With:0,_:0,__index__:0,__init__:0,_base:0,_export_:0,_multi_output:0,_output:0,_table_index_:0,_xlx:0,a567:0,a933:0,aa50:0,abbrevi:0,abc:0,abl:[0,3],about:0,abov:0,abspath:0,accept:0,access:[0,3],access_project_or_spac:0,access_tok:0,access_token:0,accesstoken:0,accordingli:0,ad:[0,3],add:[0,3],add_child:0,add_data_file_to_project:0,add_data_file_to_project_:0,add_data_file_using_project_lib:0,add_data_file_using_ws_lib:0,add_data_file_using_ws_lib_:0,add_data_into_scenario:0,add_data_into_scenario_:0,add_file_as_data_asset:0,add_file_as_data_asset_:0,add_file_as_data_asset_cpd25:0,add_file_path_as_data_asset_cpd25:0,add_file_path_as_data_asset_wsc:0,add_full_screen:0,add_layer_control:0,add_mip_progress_kpi:0,add_scenario_name_to_df:0,add_scenario_name_to_fk_constraint:0,add_sys_path:0,add_to:0,addit:0,advanc:0,advantag:0,advis:0,after:0,air:3,alia:0,all:[0,3],allow:[0,3],along:0,alreadi:0,also:[0,3],altern:0,alwai:0,an:[0,3],ani:0,anoth:0,api:[0,3],apicli:0,app:0,appear:0,appli:[0,3],applic:0,apply_and_concat:0,ar:[0,3],archiv:0,arg:0,argument:0,around:[0,3],arrow:0,asset:[0,3],asset_nam:0,assign:0,assum:0,attach:0,attachment_typ:0,attempt:0,attribut:0,auto_insert:0,autodetect:0,automat:[0,3],autoreload:0,autoscenariodbt:0,avail:[0,3],avoid:[0,3],axi:0,b7bf7fd8:0,back:0,backward:3,base:0,bash:0,basic:3,bear:0,been:[0,3],befor:0,being:0,below:0,best:0,best_bound_kpi_nam:0,better:0,between:[0,3],bewar:0,binary_var_seri:0,binary_var_series_:0,binaryvartyp:0,blank:0,blob:0,blue:0,bobhaffn:0,boilerpl:0,bool:0,both:[0,3],bound:0,box:0,br:0,build:0,builder:[0,1],bulk:0,business_kpi:0,businesskpit:0,button:0,c:0,cach:0,call:0,callback:0,came:0,camel_case_to_snake_cas:0,camelcas:0,can:[0,3],cancel:0,cannot:[0,3],cartesian:0,categor:0,categori:0,caus:0,cell:[0,3],certain:0,certif:0,ch04s23:0,challeng:0,chang:0,channel:3,charact:0,chart:0,check:0,child:0,clean:0,cleanup:0,clear:0,clear_scenario_data:0,client:[0,3],cloud:[0,3],cluster4:0,cluster:0,cluster_nam:0,co:0,code:[0,3],cogno:0,collabor:0,color:0,column:0,column_nam:0,columns_metadata:0,com:0,combin:[0,3],command:0,commun:0,compass:0,compat:[0,3],complet:0,complex:0,compon:0,comput:0,conda:3,condit:0,conf:0,configur:[0,3],connect:[0,3],constant:0,constraints_metadata:0,constructor:0,contain:[0,3],content:2,context:0,continuous_var_seri:0,continuous_var_series_:0,continuousvartyp:0,control:0,conveni:0,convers:0,convert:0,cookbook:0,coord:0,copi:0,copy_to_csv:0,core:0,corner:0,correctli:0,could:0,count:0,counti:0,cp4d25:0,cp4daa:0,cp4dv2:0,cp4dv4:0,cp:[0,3],cpd25:0,cpd25util:2,cpd2:0,cpd3:[0,3],cpd40:0,cpd4:3,cpd:[0,3],cpd_cluster_host:0,cpdaa:0,cpdv2:[0,1],cpdv3:[0,3],cpdv4:[0,1],cplex:[0,3],cpo:0,cpolab:0,cpsaa:0,creat:[0,3],create_arch:0,create_blank_map:0,create_model_arch:0,create_model_directori:0,create_new_scenario:0,create_package_extens:0,create_schema:0,create_software_specif:0,create_table_metadata:0,creation:0,credenti:0,cross:0,crossjoin:3,csv:[0,3],csv_directori:0,csv_name_pattern:0,curl:0,current:0,current_dir:0,current_valu:0,custom:0,d4c69a0d8158:0,d:[0,3],dash:0,dashboard:0,dashenterpris:0,data:[0,3],data_asset:[0,3],data_by_scenario:0,data_id:0,data_manag:0,data_url:0,datafram:0,datamanag:[2,3],datascienceelit:0,dataset:0,datetim:0,db:0,db_cell_upd:0,db_column_nam:0,db_table_nam:0,dbcellupd:0,dd:[0,3],dd_scenario:0,de:0,debug:0,debug_file_data_url:0,debug_file_dir:0,decis:3,decision_optimization_cli:0,def:0,default_max_oaas_time_limit_sec:0,default_max_run_time_sec:0,default_scenario:0,default_valu:0,defin:0,definit:0,delai:0,delet:0,delete_scenario_from_db:0,delete_scenario_name_column:0,depend:[0,3],deploi:0,deploy:[0,3],deploy_arch:0,deploy_model:0,deployed_model_nam:0,deployeddomodel:2,deployeddomodel_cpd21:0,deployeddomodelcpd21:2,deployment_descript:0,deployment_id:0,deployment_nam:0,deployment_uid:0,deprec:0,design:[0,3],despit:0,detail:3,detect_platform:0,develop:[0,3],df1:0,df2:0,df:0,df_column_names_to_snake_cas:0,df_crossjoin_ai:0,df_crossjoin_mi:0,df_crossjoin_si:0,df_dict:0,dict:0,dictionari:0,differ:[0,3],direct:0,directori:0,disadvantag:0,disk:0,dm:0,do4w:0,do_model_nam:0,do_util:0,doc:0,docplex:[0,3],document:[0,3],dodashapp:0,doe:0,doesn:0,domodeldeploy:2,domodelexport:2,done:0,down:[0,3],download:[0,3],driven:0,drop:[0,3],drop_all_t:0,drop_column_nam:0,dropdown:0,dse:[0,3],dse_do_dashboard:0,dse_do_util:1,dsx:0,dsx_project_dir:0,dsxuser:0,due:0,dump:0,dumpzipnam:0,duplic:0,duplicate_scenario_in_db:0,dure:0,dvar:[0,3],e:[0,3],each:0,easi:[0,3],easier:0,easili:0,echo:0,ef365b2c:0,effect:0,effici:0,eg:0,either:0,element:0,els:0,emb:0,empti:[0,3],en:0,enabl:0,enable_sqlite_fk:0,enable_transact:0,end:0,engin:[0,3],ensur:0,entiti:0,entri:0,enumer:0,env_is_cpd25:0,env_is_cpd40:0,env_is_dsx:0,env_is_wscloud:0,environ:[0,1],error:0,establish:0,evalu:0,exampl:0,excel:[0,3],excel_file_nam:0,excel_output_file_nam:0,excel_test:0,excelfil:0,excelwrit:0,except:0,exclud:0,execut:0,execute_model:0,execution_result:0,execution_statu:0,execution_status_json:0,exist:[0,3],expect:0,experi:0,explicit:0,explicitli:0,export_as_cpo:0,export_as_cpo_:0,export_as_lp:0,export_as_lp_:0,export_do_model:0,export_model:0,export_model_as_lp:0,expos:0,express:0,extend:0,extended_columns_metadata:0,extens:0,extract:0,extract_dvar_nam:0,extract_solut:0,f:0,fail:0,fake:3,fals:0,faster:0,featur:3,featuregroup:0,field:0,fig:0,file:[0,3],file_nam:0,file_path:0,filenam:0,filepath:0,filter:0,find:0,firefox:0,first:0,fix:0,fkc:0,flask:0,folder:0,folium:[0,3],follow:[0,3],footer:0,forc:0,foreign:0,foreignkeyconstraint:0,form:0,format:0,former:[0,3],found:0,frame:0,free:0,from:[0,3],full:0,full_project_nam:0,func:0,futur:[0,3],g:[0,3],gap:[0,3],gener:0,get:0,get_access_token_curl:0,get_access_token_web:0,get_all_scenario_nam:0,get_arrow:0,get_bear:0,get_dash_tab_layout_m:0,get_data_directori:0,get_db_table_nam:0,get_dd_client:0,get_debug_dump_name_and_url:0,get_debug_file_url:0,get_deployment_id:0,get_df_column_nam:0,get_do_model_export_curl:0,get_do_model_export_web:0,get_do_scenario:0,get_execution_service_model_url:0,get_execution_statu:0,get_head:0,get_html_tabl:0,get_input_fil:0,get_job_statu:0,get_job_url:0,get_kill_job_url:0,get_kpi_output_t:0,get_kpis_table_as_datafram:0,get_log_file_name_and_url:0,get_log_file_url:0,get_multi_scenario_data:0,get_object:0,get_output:0,get_parameter_valu:0,get_plotly_fig_m:0,get_popup_t:0,get_project_id:0,get_raw_table_by_nam:0,get_root_directori:0,get_sa_column:0,get_sa_t:0,get_scenario:0,get_scenario_db_t:0,get_scenario_picker_ui:0,get_scenario_refresh_button:0,get_scenario_select_drop_down:0,get_scenarios_df:0,get_selected_scenario:0,get_solution_name_and_url:0,get_solve_config:0,get_solve_detail:0,get_solve_details_object:0,get_solve_payload:0,get_solve_statu:0,get_solve_url:0,get_space_id:0,get_stop_job_url:0,get_tab_layout_:0,get_tooltip_t:0,get_wml_create_deployment_meta_prop:0,get_wml_create_store_model_meta_prop:0,getcwd:0,gist:0,git:0,github:[0,3],githubpag:3,give:0,given:0,glob:0,grand:0,greatli:3,gsilabs_scnfo:0,guid_from_space_nam:0,h:0,ha:[0,3],hack:3,hand:0,handl:0,happen:0,hard:0,have:[0,3],header:0,height:0,hello:0,here:0,hierarch:0,hold:0,home:0,how:[0,3],howev:0,html:0,http:0,hypothet:0,i:0,ibm:[0,3],ibm_watson_machine_learn:0,ibm_watson_studio_lib:0,icon:0,icpd:3,id:0,ignor:[0,3],imp:0,impact:3,implement:0,improv:[0,3],includ:0,inconsist:0,incorrect:0,independ:0,index:[0,1],indic:0,individu:[0,3],info:0,inform:0,init:0,initi:0,inline_t:0,inner:0,input:0,input_csv_name_pattern:0,input_db_t:0,input_table_nam:0,insecurerequestwarn:0,insert:0,insert_scenarios_from_zip:0,insert_scenarios_in_db:0,insert_table_in_db_bulk:0,insert_tables_in_db:0,instal:[0,1],installationreadm:3,instanc:0,instead:0,integ:0,integer_var_list:0,integer_var_seri:0,integer_var_series_:0,integervartyp:0,intend:3,interact:[0,3],interfac:3,intermedi:0,intern:[0,3],internet:3,interrupt:0,interv:0,io:0,ipynb:0,ipywidget:0,issu:0,itself:3,jerom:0,job:0,job_config_json:0,job_detail:0,job_uid:0,join:0,json:0,jupyt:[0,3],jupyterlab:3,just:0,kansas_city_coord:0,karg:0,keep:0,kei:0,keyword:0,kill:0,kill_job:0,km:0,kpi:0,kpitabl:0,kwarg:0,lambda:0,last:0,lat:0,later:0,latest:0,layer_control_posit:0,lead:0,leav:0,left:0,let:0,level:0,lib:0,librari:0,like:[0,3],limit:[0,3],line:0,list:0,list_file_hierarchi:0,load:0,load_data:0,load_data_from_csv:0,load_data_from_csv_:0,load_data_from_excel:0,load_data_from_excel_:0,load_data_from_scenario:0,load_data_from_scenario_:0,load_from_excel:0,load_selected_scenario_data:0,local:[0,3],local_root:0,locat:0,log:0,log_file_nam:0,logic:0,lon:0,longer:[0,3],look:0,loop:0,lp:[0,3],m:0,machin:0,made:0,mai:0,main:[0,1],main_file_path:0,maintain:0,major:0,make:0,manag:0,mani:3,manipul:[0,3],manual:0,map:[0,3],mapmanag:[2,3],marker:0,master:0,match:0,max_oaas_time_limit_sec:0,max_run_time_sec:0,maximum:0,mb:3,md:[0,3],mdl:0,me:[0,1],mean:0,medium:0,member:0,menu:[0,3],merg:0,merge_scenario_data:0,messag:0,meta_prop:0,metadata:0,method:0,mgr:0,might:3,minu:0,mip_gap_kpi_nam:0,miss:0,mix:0,mkonrad:0,mode:0,model1:0,model2:0,model:[0,1],model_archive_file_path:0,model_build:0,model_nam:0,model_uid:0,modelbuild:0,modifi:0,modul:[1,2],module_reload:0,moment:3,monitor:0,monitor_execut:0,monitor_loop_delay_sec:0,more:[0,3],most:0,mostli:3,move:3,mp:0,msm:0,multi:0,multi_scenario:0,multi_thread:0,multiindex:0,multipl:[0,3],multiscenariomanag:2,must:0,my:0,my_default_scenario:0,my_do_model:0,my_funct:0,my_input_column_nam:0,my_input_valu:0,my_output_column_name_1:0,my_output_column_name_2:0,my_output_value1:0,my_output_value_1:0,my_output_value_2:0,my_tabl:0,myexcelfil:0,myexcelfileoutput:0,myfil:0,mymodel:0,myoptimizationengin:0,myprogresslisten:0,mytabl:0,n:0,n_arrow:0,name:0,namedtupl:0,nbviewer:0,necessari:0,need:0,neither:3,net:0,never:0,new_path:0,new_scenario_nam:0,next:0,nodefault:3,non:0,none:0,not_start:0,note:[0,3],notebook:[0,3],notify_progress:0,now:0,number:0,oaa:0,object:0,off:0,ok:0,omit:0,onc:0,one:0,ones:0,onli:[0,3],open:0,oper:0,optim:[0,3],optimizationengin:[2,3],option:[0,3],order:0,ordereddict:0,ore:3,oreilli:0,org:0,organ:0,origin:0,os:0,other:[0,3],otherwis:0,out:0,output:0,output_csv_name_pattern:0,output_db_t:0,output_table_nam:0,outsid:3,overrid:0,overridden:0,overwrit:0,overwritten:0,p1:0,p2:0,packag:[1,2,3],package_path:0,page:[0,1],page_id:0,page_sourc:0,pair:0,pak:3,panda:0,panel:0,param:0,param_nam:0,param_typ:0,paramet:0,parametert:0,pardir:0,parent:0,parent_dir:0,parent_dir_2:0,pars:0,parse_html:0,part:0,particular:[0,3],pass:0,password:0,past:0,path:0,pattern:0,payload:0,pd:0,per:0,perform:[0,3],period:0,person:0,phase:0,pick:3,picker:0,pip:[0,3],pkg_ext_id:0,place:0,placehold:0,plain:0,platform:0,plot:0,plotli:0,plotly_cpd_workaround:2,plotlymanag:2,plugin:0,point:0,poll:0,polylin:0,popul:0,popup:0,popup_t:0,possibl:0,post:[0,3],post_process_contain:0,post_process_container_get_datafram:0,post_process_fail:0,post_process_inline_t:0,post_process_inline_table_get_datafram:0,post_process_interrupt:0,post_process_process:0,practic:0,pre:[0,3],prefer:3,prep_paramet:0,prepar:0,prepare_data_fram:0,prepare_input_data_fram:0,prepare_output_data_fram:0,prevent:0,previou:3,previous_valu:0,primari:0,print:0,print_hello:0,print_inputs_outputs_summari:0,print_table_nam:0,problem:0,procedur:0,process:[0,3],product:0,productionplan:0,progress:0,progress_data:0,progressdata:0,project:[0,3],project_access_token:0,project_data:[0,3],project_id:0,project_lib:0,project_nam:0,properti:0,property_1:0,property_2:0,provid:[0,3],put:3,pwd:0,py:0,pydata:0,pypi:3,python:[0,3],question:0,queu:0,quot:0,rais:0,raw:0,re:0,reach:0,read:[0,1],read_csv:0,read_multi_scenario_tables_from_db:0,read_scenario_from_db:0,read_scenario_input_tables_from_db:0,read_scenario_table_from_db:0,read_scenario_table_from_db_cach:0,read_scenario_table_from_db_callback:0,read_scenario_tables_from_db:0,read_scenario_tables_from_db_cach:0,read_scenarios_from_db:0,read_scenarios_table_from_db_cach:0,read_scenarios_table_from_db_callback:0,readthedoc:0,reason:0,record:0,reduc:0,refactor:3,refer:0,refine_conflict:0,reflect:0,refresh:0,regist:0,regular:0,regularli:[0,3],rel:0,relat:0,relationship:0,releas:3,relev:0,reliabl:0,reload:0,remot:0,remov:0,renam:0,rename_scenario_in_db:0,repeatedli:0,replac:0,replace_data_in_scenario:0,replace_data_into_scenario_:0,replace_scenario_in_db:0,replace_scenario_tables_in_db:0,repositori:3,repres:0,represent:0,request:0,requir:[0,1],rerun:0,resourc:0,respons:0,rest:0,restor:0,restrict:0,result:0,retreiv:0,retriev:0,retrieve_debug_materi:0,retrieve_fil:0,retrieve_solut:0,retrieve_solve_configur:0,right:0,root:0,root_dir:0,rotat:0,round:0,rout:0,routin:0,row:0,row_idx:0,row_index:0,run:[0,3],runtime_env_apsx_url:0,s:0,same:[0,3],save:0,scenario:[0,3],scenario_1:0,scenario_nam:0,scenario_table_nam:0,scenariodbmanag:2,scenariodbt:0,scenariomanag:[2,3],scenariopick:[2,3],scenariorefreshbutton:0,scenarios_table_read_callback:0,scenariot:0,schema:0,scnfo:0,scnfo_dash_pycharm_github:0,scope:1,screen:0,script:3,search:[0,1],second:0,see:[0,3],seem:0,select:0,self:0,separ:[0,3],sequenc:0,seri:0,server:0,servic:0,service_configuration_json:0,service_nam:0,set:0,set_index:0,set_output_settings_in_solve_configur:0,set_paramet:0,set_scenarios_table_read_callback:0,set_table_read_callback:0,setup:0,share:3,sheet:0,should:[0,3],show:0,side:0,signific:3,similar:0,simpl:0,simplenamespac:0,simplest:0,simpli:0,sinc:0,singl:0,site:0,size:0,skip:0,sm:0,small:0,snake_cas:0,so:0,solut:0,solution_count_kpi_nam:0,solutionlisten:0,solv:0,solve_config:0,solve_config_json:0,solve_payload:0,solve_phase_kpi_nam:0,solve_statu:0,solve_time_kpi_nam:0,solvesolut:0,some:[0,3],someth:0,somewhat:0,sourc:[0,3],source_scenario_nam:0,sp:0,space:0,space_id:0,space_nam:0,spd:0,specifi:0,speed:0,spreadhseet:3,spreadsheet:0,sql:0,sqlalchemi:0,sqlcol:0,ssl:0,stackoverflow:0,stamp:0,standard:0,start:0,startpath:0,state:0,statement:0,statu:0,step:0,stop:0,stop_job:0,storag:0,store:[0,3],str:0,strftime:0,string:0,strongli:0,structur:0,studio:[0,3],sub:0,subclass:[0,3],submiss:0,submodul:2,succesfulli:0,suffici:0,suggest:0,summari:0,support:0,suppress:0,suppress_warn:0,sure:0,surround:0,sw_spec_id:0,sy:0,system:[0,3],t:0,tabl:[0,3],table_index_sheet:0,table_metadata:0,table_nam:0,table_read_callback:0,target:[0,1],target_scenario_nam:0,task:0,templat:0,template_scenario_nam:0,temporari:0,termin:0,test:0,text:0,than:0,thei:0,them:0,therebi:0,therefor:[0,3],thi:[0,3],thing:0,those:0,thu:0,time:0,time_limit:0,tmp_dir:0,todo:0,token:0,tooltip:0,tooltip_t:0,top:0,topleft:0,touch:0,track:0,transact:0,translat:0,tree:0,truth:0,tupl:0,turn:0,two:0,txt:0,type:0,typic:[0,3],ugli:0,ui:0,uid:0,un:0,under:0,unfortun:0,uniqu:0,unknown:0,unnam:0,untest:0,unverifi:0,up:[0,3],updat:0,update_cell_changes_in_db:0,update_scenario_output_tables_in_db:0,update_solve_output_into_scenario:0,upload:[0,3],url:0,urllib3:0,us:[0,3],usag:[0,3],user:0,user_access_token:0,user_nam:0,util:[2,3],v0:3,v2:3,v4:3,valid:0,valu:0,value_1:0,value_2:0,value_format:0,valueerror:0,variabl:0,venv:0,veri:3,verif:0,verifi:0,verify_integr:0,version:[2,3],via:0,view:0,visibl:0,visual:[0,3],vt:0,w:0,wa:0,wai:0,want:0,warn:0,watson:[0,3],watsonmachinelearningapicli:0,we:0,web:0,well:0,what:0,whatev:0,wheel:3,when:[0,3],where:0,which:0,whole:0,widget:0,widget_button:0,widget_select:0,width:0,wil:0,window:0,within:[0,3],without:0,wml:[0,1],wml_create_deploy:0,wml_credenti:0,wml_store_model:0,work:[0,3],world:0,would:0,write:[0,3],write_data_asset_as_file_cpd25:0,write_data_asset_as_file_wsc:0,write_data_into_scenario:0,write_data_into_scenario_:0,write_data_to_csv:0,write_data_to_csv_:0,write_data_to_excel:0,write_data_to_excel_:0,write_do_model_to_fil:0,write_main_fil:0,write_yaml_fil:0,writer:0,written:0,ws:[0,3],wsl1:0,wsl:[0,3],wslib:0,wslv1:3,wsuser:0,www:0,xdvar:0,xl:0,xlsx:0,xlx:0,xxx:0,xxxxxx:0,y:0,yaml_file_path:0,yet:0,yml:0,you:0,your:0,yyyymmdd_hhmm:0,zip:[0,3],zoom_start:0},titles:["dse_do_utils package","Welcome to DSE DO Utils documentation!","dse_do_utils","Read me"],titleterms:{"0":3,"5":3,"class":3,"do":[1,3],"import":3,builder:3,content:[0,1],cpd25util:0,cpdv2:3,cpdv4:3,custom:3,datamanag:0,deployeddomodel:0,deployeddomodelcpd21:0,document:1,domodeldeploy:0,domodelexport:0,dse:1,dse_do_util:[0,2,3],environ:3,indic:1,instal:3,main:3,mapmanag:0,me:3,model:3,modul:[0,3],multiscenariomanag:0,optimizationengin:0,packag:0,plotly_cpd_workaround:0,plotlymanag:0,read:3,requir:3,scenariodbmanag:0,scenariomanag:0,scenariopick:0,scope:3,submodul:0,tabl:1,target:3,util:[0,1],version:0,welcom:1,wml:3}})
\ No newline at end of file
diff --git a/dse_do_utils/mapmanager.py b/dse_do_utils/mapmanager.py
index f604a76..3a8dfb0 100644
--- a/dse_do_utils/mapmanager.py
+++ b/dse_do_utils/mapmanager.py
@@ -6,6 +6,8 @@
# MapManager
# -----------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------
+from typing import List, Tuple
+
class MapManager(object):
"""Base class for building Folium map visualization.
@@ -256,3 +258,21 @@ def get_popup_table(rows):
popup = folium.Popup(html, parse_html=True, max_width=2650)
return popup
+ @staticmethod
+ def get_tooltip_table(rows: List[Tuple[str,str]]) -> str:
+ """Get a tooltip table, based on the same definition as for `get_popup_table``.
+ Convenience method. Is the same as `MapManager.get_html_table(rows)`.
+ Usage::
+
+ tooltip_table = [
+ ('property_1', 'value_1'),
+ ('property_2', 'value_2'),
+ ]
+ tooltip = MapManager.get_tooltip_table(tooltip_table)
+
+
+ :param rows: list of tuples with name-value pairs
+
+ :returns (str): text for a tooltip in table format
+ """
+ return MapManager.get_html_table(rows)
diff --git a/dse_do_utils/optimizationengine.py b/dse_do_utils/optimizationengine.py
index 172cdcc..7fd75bd 100644
--- a/dse_do_utils/optimizationengine.py
+++ b/dse_do_utils/optimizationengine.py
@@ -97,7 +97,7 @@ def solve(self, refine_conflict: bool = False, **kwargs) -> docplex.mp.solution.
def get_kpi_output_table(self) -> pd.DataFrame:
all_kpis = [(kp.name, kp.compute()) for kp in self.mdl.iter_kpis()]
- df_kpis = pd.DataFrame(all_kpis, columns=['kpi', 'value'])
+ df_kpis = pd.DataFrame(all_kpis, columns=['NAME', 'VALUE'])
return df_kpis
def export_as_lp(self, local_root: Optional[str] = None, copy_to_csv: bool = False) -> str:
diff --git a/dse_do_utils/scenariodbmanager.py b/dse_do_utils/scenariodbmanager.py
index a599f07..f876306 100644
--- a/dse_do_utils/scenariodbmanager.py
+++ b/dse_do_utils/scenariodbmanager.py
@@ -85,14 +85,20 @@ def get_sa_table(self) -> Optional[sqlalchemy.Table]:
return self.table_metadata
def get_sa_column(self, db_column_name) -> Optional[sqlalchemy.Column]:
- """Returns the SQLAlchemy column with the specified name.
- Dynamically creates a dict/hashtable for more efficient access."""
- # for c in self.columns_metadata:
- # if isinstance(c, sqlalchemy.Column) and c.name == db_column_name:
- # return c
- if self._sa_column_by_name is None:
- self._sa_column_by_name = {c.name: c for c in self.columns_metadata if isinstance(c, sqlalchemy.Column)}
- return self._sa_column_by_name.get(db_column_name) # returns None if npt found (?)
+ """Returns the SQLAlchemy.Column with the specified name.
+ Uses the self.table_metadata (i.e. the sqlalchemy.Table), so works both for pre-defined tables and self-reflected tables like AutoScenarioDbTable
+ """
+ # Grab column directly from sqlalchemy.Table, see https://docs.sqlalchemy.org/en/14/core/metadata.html#accessing-tables-and-columns
+ if (self.table_metadata is not None) and (db_column_name in self.table_metadata.c):
+ return self.table_metadata.c[db_column_name]
+ else:
+ return None
+
+ # # Not 100% sure if this is being called after the potential reflection, so also allow generating the self._sa_column_by_name if length is zero
+ # if self._sa_column_by_name is None or len(self._sa_column_by_name) == 0:
+ # # self._sa_column_by_name = {c.name: c for c in self.columns_metadata if isinstance(c, sqlalchemy.Column)} # Original way: based on self.columns_metadata
+ # self._sa_column_by_name = {c.name: c for c in self.table_metadata.c if isinstance(c, sqlalchemy.Column)} # Works both with normally defined table and reflected table (w. AutoScenarioBdTable)
+ # return self._sa_column_by_name.get(db_column_name) # returns None if npt found (?)
def create_table_metadata(self, metadata, engine, schema, multi_scenario: bool = False) -> sqlalchemy.Table:
"""If multi_scenario, then add a primary key 'scenario_name'.
@@ -216,9 +222,13 @@ def create_table_metadata(self, metadata, engine, schema, multi_scenario: bool =
self.engine = engine
self.schema = schema
+ # TODO: From the reflected Table, also extract the columns_metadata.
+ # We need that for any DB edits
+
# print(f"create_table_metadata: ")
if engine is not None:
return self._reflect_db_table(metadata, engine, schema)
+
return None
def insert_table_in_db_bulk(self, df, mgr, connection=None):
@@ -306,7 +316,7 @@ def __init__(self, input_db_tables: Dict[str, ScenarioDbTable], output_db_tables
:param enable_sqlite_fk: If True, enables FK constraint checks in SQLite
"""
# WARNING: do NOT use 'OrderedDict[str, ScenarioDbTable]' as type. OrderedDict is not subscriptable. Will cause a syntax error.
- self.schema = schema
+ self.schema = self._check_schema_name(schema)
self.multi_scenario = multi_scenario # If true, will add a primary key 'scenario_name' to each table
self.enable_transactions = enable_transactions
self.enable_sqlite_fk = enable_sqlite_fk
@@ -324,6 +334,12 @@ def __init__(self, input_db_tables: Dict[str, ScenarioDbTable], output_db_tables
############################################################################################
# Initialization. Called from constructor.
############################################################################################
+ def _check_schema_name(self, schema: str):
+ """Checks if schema name is not mixed-case, as this is known to cause issues. Upper-case works well.
+ This is just a warning. It does not change the schema name."""
+ if not schema.islower() and not schema.isupper(): ## I.e. is mixed_case
+ print(f"Warning: using mixed case in the schema name {schema} may cause unexpected DB errors. Use upper-case only.")
+ return schema
def _add_scenario_db_table(self, input_db_tables: Dict[str, ScenarioDbTable]) -> Dict[str, ScenarioDbTable]:
"""Adds a Scenario table as the first in the OrderedDict (if it doesn't already exist).
@@ -484,7 +500,10 @@ def _create_db2_engine(self, credentials, schema: str, echo: bool = False):
def _initialize_db_tables_metadata(self):
"""To be called from constructor, after engine is 'created'/connected, after self.metadata, self.multi_scenario have been set.
This will add the `scenario_name` to the db_table configurations.
- This also allows non-bulk inserts into an existing DB (i.e. without running 'create_schema')"""
+ This also allows non-bulk inserts into an existing DB (i.e. without running 'create_schema')
+
+ TODO: also reflect the columns_metadata. That is required for any table edits
+ """
for scenario_table_name, db_table in self.db_tables.items():
db_table.table_metadata = db_table.create_table_metadata(self.metadata,
self.engine,
@@ -900,10 +919,13 @@ def _read_scenario_db_table_from_db_thread(self, scenario_table_name, db_table):
return inputs, outputs
- def read_scenario_input_tables_from_db(self, scenario_name: str):
+ def read_scenario_input_tables_from_db(self, scenario_name: str) -> Inputs:
"""Convenience method to load all input tables.
- Typically used at start if optimization model."""
- return self.read_scenario_tables_from_db(scenario_name, input_table_names=['*'])
+ Typically used at start if optimization model.
+ :returns The inputs and outputs. (The outputs are always empty.)
+ """
+ inputs, outputs = self.read_scenario_tables_from_db(scenario_name, input_table_names=['*'])
+ return inputs
def read_scenario_tables_from_db(self, scenario_name: str,
input_table_names: Optional[List[str]] = None,
@@ -973,6 +995,63 @@ def _read_scenario_db_table_from_db(self, scenario_name: str, db_table: Scenario
return df
+ ############################################################################################
+ # Read multi scenario
+ ############################################################################################
+ def read_multi_scenario_tables_from_db(self, scenario_names: List[str],
+ input_table_names: Optional[List[str]] = None,
+ output_table_names: Optional[List[str]] = None) -> (Inputs, Outputs):
+ """Read selected set input and output tables from multiple scenarios.
+ If input_table_names/output_table_names contains a '*', then all input/output tables will be read.
+ If empty list or None, then no tables will be read.
+ """
+ if self.enable_transactions:
+ with self.engine.begin() as connection:
+ inputs, outputs = self._read_multi_scenario_tables_from_db(connection, scenario_names, input_table_names, output_table_names)
+ else:
+ inputs, outputs = self._read_multi_scenario_tables_from_db(self.engine, scenario_names, input_table_names, output_table_names)
+ return inputs, outputs
+
+ def _read_multi_scenario_tables_from_db(self, connection, scenario_names: List[str],
+ input_table_names: List[str] = None,
+ output_table_names: List[str] = None) -> (Inputs, Outputs):
+ """Loads data for selected input and output tables from multiple scenarios.
+ If either list is names is ['*'], will load all tables as defined in db_tables configuration.
+ """
+ if input_table_names is None: # load no tables by default
+ input_table_names = []
+ elif '*' in input_table_names:
+ input_table_names = list(self.input_db_tables.keys())
+
+ # Add the scenario table
+ if 'Scenario' not in input_table_names:
+ input_table_names.append('Scenario')
+
+ if output_table_names is None: # load no tables by default
+ output_table_names = []
+ elif '*' in output_table_names:
+ output_table_names = self.output_db_tables.keys()
+
+ inputs = {}
+ for scenario_table_name, db_table in self.input_db_tables.items():
+ if scenario_table_name in input_table_names:
+ inputs[scenario_table_name] = self._read_multi_scenario_db_table_from_db(scenario_names, db_table, connection=connection)
+ outputs = {}
+ for scenario_table_name, db_table in self.output_db_tables.items():
+ if scenario_table_name in output_table_names:
+ outputs[scenario_table_name] = self._read_multi_scenario_db_table_from_db(scenario_names, db_table, connection=connection)
+ return inputs, outputs
+
+ def _read_multi_scenario_db_table_from_db(self, scenario_names: List[str], db_table: ScenarioDbTable, connection) -> pd.DataFrame:
+ """Read one table from the DB for multiple scenarios.
+ Does NOT remove the `scenario_name` column.
+ """
+ t: sqlalchemy.Table = db_table.get_sa_table() #table_metadata
+ sql = t.select().where(t.c.scenario_name.in_(scenario_names)) # This is NOT a simple string!
+ df = pd.read_sql(sql, con=connection)
+
+ return df
+
############################################################################################
# Update scenario
############################################################################################
@@ -1006,6 +1085,7 @@ def _update_cell_change_in_db(self, db_cell_update: DbCellUpdate, connection):
t: sqlalchemy.Table = db_table.get_sa_table()
pk_conditions = [(db_table.get_sa_column(pk['column']) == pk['value']) for pk in db_cell_update.row_index]
target_col: sqlalchemy.Column = db_table.get_sa_column(db_cell_update.column_name)
+ print(f"_update_cell_change_in_db - target_col = {target_col} for db_cell_update.column_name={db_cell_update.column_name}, pk_conditions={pk_conditions}")
sql = t.update().where(sqlalchemy.and_((t.c.scenario_name == db_cell_update.scenario_name), *pk_conditions)).values({target_col:db_cell_update.current_value})
# print(f"_update_cell_change_in_db = {sql}")
@@ -1421,7 +1501,7 @@ def read_scenario_tables_from_db_cached(self, scenario_name: str,
def read_scenarios_from_db(self, scenario_names: List[str] = []) -> (Inputs, Outputs):
- """Multi scenario load.
+ """DEPRECATED. Multi scenario load.
Reads all tables from set of scenarios
TODO: avoid use of text SQL. Use SQLAlchemy sql generation.
"""
diff --git a/dse_do_utils/version.py b/dse_do_utils/version.py
index f986ccd..5aab1b0 100644
--- a/dse_do_utils/version.py
+++ b/dse_do_utils/version.py
@@ -9,4 +9,4 @@
See https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package
"""
-__version__ = "0.5.4.1"
+__version__ = "0.5.4.2"