Skip to content
Snippets Groups Projects
Commit 5d4b1b2a authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Changed the arguments dictionary storing in manifest table to use short version

parent bf80be73
No related branches found
No related tags found
No related merge requests found
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.1"
julia_version = "1.10.2"
manifest_format = "2.0"
project_hash = "e779bdcde2818be4a3cc541fcc30e32777ccbc5d"
project_hash = "5059d18894b0dfc2cb23e11ebea369b27c20f114"
[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
......@@ -79,9 +79,9 @@ version = "1.6.1"
[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "1fb174f0d48fe7d142e1109a10636bc1d14f5ac2"
git-tree-sha1 = "0f4b5d62a88d8f59003e43c25a8a90de9eb76317"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.17"
version = "0.18.18"
[[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
......@@ -111,10 +111,10 @@ uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.9.3"
[[deps.Documenter]]
deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "Test", "Unicode"]
git-tree-sha1 = "2613dbec8f4748273bbe30ba71fd5cb369966bac"
deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"]
git-tree-sha1 = "4a40af50e8b24333b9ec6892546d9ca5724228eb"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "1.2.1"
version = "1.3.0"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
......@@ -154,9 +154,9 @@ version = "2.36.1+2"
[[deps.HTTP]]
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
git-tree-sha1 = "ac7b73d562b8f4287c3b67b4c66a5395a19c1ae8"
git-tree-sha1 = "db864f2d91f68a5912937af80327d288ea1f3aee"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "1.10.2"
version = "1.10.3"
[[deps.IOCapture]]
deps = ["Logging", "Random"]
......@@ -203,7 +203,7 @@ version = "0.21.4"
[[deps.JuliaDockerClient]]
deps = ["Base64", "Documenter", "HTTP", "JSON", "Sockets", "Test"]
git-tree-sha1 = "332372d89f5022323031770ee8eecf37063e6538"
git-tree-sha1 = "ee1f4dbcca6435efb77b22254f68dbff27668789"
repo-rev = "main"
repo-url = "https://FACT_token:glpat-1zG-TQx___xLsPjj2vsG@git.nilu.no/fact/utils/JuliaDockerClient.git"
uuid = "a780814a-4c69-448d-b4b8-c460781333f9"
......@@ -343,9 +343,9 @@ version = "0.8.1+2"
[[deps.OpenSSL]]
deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"]
git-tree-sha1 = "51901a49222b09e3743c65b8847687ae5fc78eb2"
git-tree-sha1 = "af81a32750ebc831ee28bdaaba6e1067decef51e"
uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c"
version = "1.4.1"
version = "1.4.2"
[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
......@@ -394,9 +394,9 @@ version = "1.2.0"
[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.1"
version = "1.4.3"
[[deps.PrettyTables]]
deps = ["Crayons", "LaTeXStrings", "Markdown", "PrecompileTools", "Printf", "Reexport", "StringManipulation", "Tables"]
......@@ -514,9 +514,9 @@ deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[deps.TranscodingStreams]]
git-tree-sha1 = "54194d92959d8ebaa8e26227dbe3cdefcdcd594f"
git-tree-sha1 = "3caa21522e7efac1ba21834a03734c57b4611c7e"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.10.3"
version = "0.10.4"
weakdeps = ["Random", "Test"]
[deps.TranscodingStreams.extensions]
......
......@@ -10,5 +10,6 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuliaDockerClient = "a780814a-4c69-448d-b4b8-c460781333f9"
MySQL = "39abe10b-433b-5dbd-92d4-e302a9df00cd"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
......@@ -32,7 +32,7 @@ The module exports various functions from included scripts. Key functionalities
"""
module FACTResultsIO
using MySQL, JSON, DataFrames, UUIDs, Dates
using MySQL, JSON, DataFrames, UUIDs, Dates. SHA
using JuliaDockerClient
include("utilsDocker.jl")
......@@ -42,6 +42,6 @@ module FACTResultsIO
export get_connection, close_connection
include("manifestIO.jl")
export get_table, write_table, overwrite_table, find_table_name_in_manifest
export get_table, write_table, overwrite_table
end
......@@ -23,8 +23,8 @@ This function first attempts to find the table name in a 'manifest' table using
In this example, `get_table` is called with a MySQL connection `conn` and specific method details. It retrieves data from the identified table in the database and returns it as a DataFrame.
"""
function get_table(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, references_string::String)
table_str = find_table_name_in_manifest(conn, method_name, arguments_string, arguments, references_string)
function get_table(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict)
table_str = find_table_name_in_manifest(conn, method_name, arguments_string, arguments)
df = DataFrame()
if table_str == ""
......@@ -61,10 +61,10 @@ Write data from a DataFrame to a MySQL table based on the specified method name
In this example, the `write_table` function attempts to write the contents of `results` DataFrame to a MySQL table. If a table corresponding to `method_name` and `arguments_string` does not exist, it will be created and populated with the data from `results`. If such a table already exists, an error will be raised.
"""
function write_table(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, references_string::String, results::DataFrame)
table_str = find_table_name_in_manifest(conn, method_name, arguments_string, arguments, references_string)
function write_table(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, results::DataFrame)
table_str = find_table_name_in_manifest(conn, method_name, arguments_string, arguments)
if table_str == ""
table_name = write_table_name_in_manifest(conn, method_name, arguments_string, arguments, references_string)
table_name = write_table_name_in_manifest(conn, method_name, arguments_string, arguments)
create_table_from_dataframe(conn, results, table_name)
try
......@@ -104,8 +104,8 @@ If the table does not exist, it is simply created and the data is written to it.
In this example, `overwrite_table` is called with a MySQL connection, method name, arguments, and a DataFrame. If a table matching the method name and arguments exists, it is overwritten with the new data from the DataFrame.
"""
function overwrite_table(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, references_string::String, results::DataFrame)
table_str = find_table_name_in_manifest(conn, method_name, arguments_string, arguments, references_string)
function overwrite_table(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, results::DataFrame)
table_str = find_table_name_in_manifest(conn, method_name, arguments_string, arguments)
# delete already existing data
if table_str != ""
......@@ -116,7 +116,7 @@ function overwrite_table(conn::MySQL.Connection, method_name::String, arguments_
end
# write new data
write_table(conn, method_name, arguments_string, arguments, references_string, results)
write_table(conn, method_name, arguments_string, arguments, results)
end
"""
......@@ -144,9 +144,9 @@ This function queries the 'manifest' table for an entry that matches the specifi
In this example, `find_table_name_in_manifest` is used to search for a table in the 'manifest' table that matches the given method name and arguments. It returns the name of the found table or an empty string if no match is found.
"""
function find_table_name_in_manifest(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, references_string::String)
function find_table_name_in_manifest(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict)
# Serialize the arguments dictionary to a JSON string
arguments_dict = JSON.json(arguments) * references_string
arguments_dict = bytes2hex(sha256(JSON.json(arguments)))
# Prepare and execute a query to check if the entry exists in the manifest table
query = """
......@@ -222,9 +222,9 @@ This function first serializes the provided arguments dictionary into a JSON str
In this example, `write_table_name_in_manifest` is called with a MySQL connection, method name, arguments string, and a dictionary of arguments. It inserts a new entry into the 'manifest' table and returns the generated table name.
"""
function write_table_name_in_manifest(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict, references_string::String)
function write_table_name_in_manifest(conn::MySQL.Connection, method_name::String, arguments_string::String, arguments::Dict)
# Serialize the arguments dictionary to a JSON string
arguments_dict = JSON.json(arguments) * references_string
arguments_dict = bytes2hex(sha256(JSON.json(arguments)))
# Generate a random table name
result_table_name = generate_random_table_name(10)
......
......@@ -21,7 +21,7 @@ function create_manifest_table(conn::MySQL.Connection)
id INT AUTO_INCREMENT PRIMARY KEY,
method_name VARCHAR(255) NOT NULL,
arguments_string VARCHAR(255) NOT NULL,
arguments_dict VARCHAR(255) NOT NULL,
arguments_dict VARCHAR(64) NOT NULL,
result_table_name VARCHAR(255) NOT NULL
);
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment