IBM / dse-decision-optimization-utilities

A Python package with various utilities that speed-up development of Decision Optimization projects in Watson Studio. Implements common tasks and provides best-practice guidelines to architect DO projects.
Apache License 2.0
4 stars 7 forks source link

Get AutoScenarioDbTable back working #21

Closed victorterpstra closed 2 years ago

victorterpstra commented 2 years ago

The AutoScenarioDbTable needs to be tested and debugged. Might not be working properly.

Background Typically, one would define a subclass of ScenarioDbTable to encode the schema information of a table (columns, data types, PKs, FKs, etc.) But that can be a lot of work. SQLAlchemy is capable of automatically generating the DB table definition from a DataFrame. At some early point in development, this feature was working. That is what the AutoScenarioDbTable is designed for, i.e. when a table is included in the ScenarioDbManager subclass using the AutoScenarioDbTable as the class, the ScenarioDbManager should be able to insert the data based on the DataFrame columns and datatypes. Avoiding the need to explicitly define all columns.

TODO:

victorterpstra commented 2 years ago

Fixed in v0.5.1.1b Challenge was the delete scenario from tables that do not exist. I.e. since no tables are created in the new schema, scenario data cannot be deleted from table. Fixed by checking of the table exists before executing the DELETE FROM. After this fix, the AutoScenarioDbTable seems to work fine.