goblin_lite.resource_manager.database_manager
This module contains the DataManager class, which is responsible for managing the database for the GOBLIN LCA framework. The DataManager class is responsible for creating, clearing, and saving data to the database. It also retrieves data from the database.
Module Contents
Classes
Manages the GOBLIN LCA database. |
- class goblin_lite.resource_manager.database_manager.DataManager(external_database_path=None)[source]
Manages the GOBLIN LCA database.
This class is responsible for managing the database for the GOBLIN LCA framework. It is responsible for creating, clearing, and saving data to the database. It also retrieves data from the database.
- database_dir
The directory where the database is stored.
- Type:
str
- engine
- Type:
sqlalchemy.engine.base.Engine
- save_goblin_results_output_datatable(data, table, index=True)[source]
Saves a DataFrame to the database.
- get_goblin_results_output_datatable(table, index_col=None)[source]
Retrieves a DataFrame from the database.
- data_engine_creater()[source]
Creates the database engine based on either the default or provided external database path.
- Returns:
The database engine.
- Return type:
sqlalchemy.engine.base.Engine
- create_or_clear_database()[source]
Creates or clears the database.
This method creates or clears the database. If the database already exists, it is cleared using the declarative approach.
- Return type:
None
- save_goblin_results_output_datatable(data, table, index=True)[source]
Saves a DataFrame to the database.
This method saves a DataFrame to the database.
- Parameters:
data (pandas.DataFrame) – The DataFrame to save.
table (str) – The name of the table to save the DataFrame to.
index (bool, optional) – Whether to save the index. Defaults to True.
- Return type:
None
- save_goblin_results_to_database(*args)[source]
Saves data to the database.
This method saves data to the database.
- Parameters:
*args – The data to save.
- Return type:
None
- get_goblin_results_output_datatable(table, index_col=None)[source]
Retrieves a DataFrame from the database.
This method retrieves a DataFrame from the database.
- Parameters:
table (str) – The name of the table to retrieve the DataFrame from.
index_col (str, optional) – The column to use as the index. Defaults to None.
- Returns:
The DataFrame retrieved from the database.
- Return type:
pandas.DataFrame