6.7.1. pilotscope.DataManager.DataManager
- class DataManager(config: pilotscope.PilotConfig.PilotConfig)[source]
Bases:
object
This class provides methods to interact with a database to store and retrieve data.
- __init__(config: pilotscope.PilotConfig.PilotConfig) → None[source]
Initialize the DataManager.
- Parameters
config – The configuration of PilotScope.
- read_all(table_name)[source]
Read all rows from a given table.
- Parameters
table_name – The name of the table to read from.
- Returns
All rows in the specified table as a pandas DataFrame.
- read_update(table_name)[source]
Read the new rows from a given table since the last visit. This function will also update the last visit record in the database.
- Parameters
table_name – The name of the table to read .
- Returns
The new rows in the specified table since the last visit as a pandas DataFrame.
- save_data(table_name, column_2_value)[source]
Save data to the specified table in the database.
- Parameters
table_name – The name of the table to insert the data into.
column_2_value – A dictionary of column names and their corresponding values, e.g., {‘id’: 1, ‘name’: ‘John Doe’}