From 8ea693bca6cc07b2ac9a27acb73cabcc29329176 Mon Sep 17 00:00:00 2001 From: Riccardo Boero <ribo@nilu.no> Date: Tue, 10 Dec 2024 17:35:01 +0100 Subject: [PATCH] Fix results connection names to avoid misunderstandings --- CHANGELOG | 4 ++++ Project.toml | 2 +- src/FACT_unified_data_IO.jl | 2 +- src/utils/db.jl | 20 +++++++++++++++----- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index fb9f3b7..ff16e2f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,10 @@ Removed: For features removed in this release. Fixed: For any bug fixes. Security: For vulnerabilities. +## [0.0.3] - 12-10-2024 +Fixed: +- names for results connections + ## [0.0.2] - 12-10-2024 Fixed: - use of system services for results diff --git a/Project.toml b/Project.toml index 38fe1a6..180c3ce 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FACT_unified_data_IO" uuid = "ec8d5dc6-0dfe-41d7-8c2c-855ff50b7b42" authors = ["Riccardo Boero <ribo@nilu.no>"] -version = "0.0.2" +version = "0.0.3" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/src/FACT_unified_data_IO.jl b/src/FACT_unified_data_IO.jl index 5fbb6f7..48c78a0 100644 --- a/src/FACT_unified_data_IO.jl +++ b/src/FACT_unified_data_IO.jl @@ -36,7 +36,7 @@ module FACT_unified_data_IO using OrchestratorRegistry include("utils/db.jl") - export get_connection, close_connection + export get_results_connection, close_connection include("utils/manifestIO.jl") export get_table, write_table, overwrite_table, does_table_exist_for_method diff --git a/src/utils/db.jl b/src/utils/db.jl index edb483d..7212d83 100644 --- a/src/utils/db.jl +++ b/src/utils/db.jl @@ -31,7 +31,7 @@ function create_manifest_table(conn::MySQL.Connection) end """ -create_database(service::OrchestratorRegistry.Service) +create_results_database(service::OrchestratorRegistry.Service) Ensures the `FACT_results` database exists for the specified service. @@ -60,7 +60,7 @@ service = Service("123", "auth-service", "http://localhost", 3306) create_database(service) ``` """ -function create_database(service::OrchestratorRegistry.Service) +function create_results_database(service::OrchestratorRegistry.Service) conn = establish_connection(service.host, "root", "devops", ""; port=service.port) # Prepare query @@ -74,7 +74,7 @@ function create_database(service::OrchestratorRegistry.Service) end """ -get_connection(service::OrchestratorRegistry.Service) +get_results_connection(service::OrchestratorRegistry.Service) Establishes and returns a database connection for the specified service. @@ -112,9 +112,9 @@ conn = get_connection(service) execute_query(conn, "SELECT * FROM manifest") ``` """ -function get_connection(service::OrchestratorRegistry.Service) +function get_results_connection(service::OrchestratorRegistry.Service) # Create the databse if it does not exist - create_database(service) + create_results_database(service) # Connect to the database conn = establish_connection(service.host, "root", "devops", "FACT_results"; port=service.port) @@ -125,6 +125,16 @@ function get_connection(service::OrchestratorRegistry.Service) return conn end +function get_results_connection(service_dict::Dict) + service = Service( + "id", + "name", + service_dict["host"], + service_dict["port"] + ) + return get_connection(service) +end + """ close_connection(conn::MySQL.Connection) -- GitLab