OpenDB
- class openmsimodel.db.open_db.OpenDB(database_name, private_path, output)
Bases:
RunnableOpenDB - Database Interaction Tool
This tool allows interaction with a database for managing model artifacts. It provides capabilities for loading models, executing queries, and more.
- ARGUMENT_PARSER_TYPE
alias of
OpenMSIModelParser
- setup(database_name, private_path)
Set up the OpenDB tool.
- Parameters:
database_name – Name of the database to connect to.
private_path – Path to a JSON file containing database credentials.
- record_query_results(sql_results, query, name, dump=True)
Print query results and optionally save them to a CSV file.
- Parameters:
- Returns:
The input DataFrame (sql_results).
- Return type:
DataFrame
- Raises:
ValueError – If an error occurs while saving to the output file.
- Examples:
Example 1:
result_df = self.load_model("example_model", "/path/to/model") query = "SELECT * FROM data" self.print_and_dump(result_df, query, "data_output")
- list_queries()
List and display available queries along with their documentation.
- classmethod get_command_line_arguments()
Get the list of argument names and the dictionary of argument names/default values to add to the argument parser