From 526ca4846cd70e2d0bbd7f2b048b587b58450d48 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Thu, 23 Feb 2023 15:53:56 -0500 Subject: [PATCH 01/58] Attempt to fix JDBC dispatch for DBInterface --- src/jdbc.jl | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/jdbc.jl b/src/jdbc.jl index 1627904..51b6eb8 100644 --- a/src/jdbc.jl +++ b/src/jdbc.jl @@ -8,23 +8,33 @@ function DBInterface.connect(::Type{JDBC.Connection}, args...; connection_string catch println("JVM already initialized") end - JDBC.Connection(connection_string) + JDBC.DriverManager.getConnection(connection_string) end """ -Dispatch for LibPQ interface to DBInterface `prepare` function -TODO: Not fully implemented yet +Dispatch for JDBC interface to DBInterface `prepare` function +BUG: Doesn't seem to work for all JDBC versions yet """ -# DBInterface.prepare(conn::JDBC.Connection, args...; kws...) = -# JDBC.prepareStatement(conn, args...; kws...) +function DBInterface.prepare(conn::JDBC.JavaObject{Symbol("java.sql.Connection")}, args...; kws...) + stmt = JDBC.createStatement(conn) + result = executeQuery(stmt, args...) + return result +end + +""" +Workaround for JDBC interface to DBInterface's `execute` function +""" +function DBInterface.execute(conn::JDBC.JavaObject{Symbol("java.sql.ResultSet")}, args...; kws...) + JDBC.Source(conn) +end """ -Workaround for LibPQ interface to DBInterface's `execute` function +Workaround for JDBC interface to DBInterface's `execute` function """ -function DBInterface.execute(conn::Union{JDBC.Connection, JDBC.JPreparedStatement}, args...; kws...) - csr = JDBC.cursor(conn) - JDBC.execute!(csr, args..., kws...) - JDBC.Source(csr) +function DBInterface.execute(conn::JDBC.JavaObject{Symbol("java.sql.Connection")}, args...; kws...) + stmt = JDBC.createStatement(conn) + result = executeQuery(stmt, args...) + JDBC.Source(result) end From 9ea3bd1a24b425d0d865fbbae12cf603ce5e3eb7 Mon Sep 17 00:00:00 2001 From: Farreeda <94711213+Farreeda@users.noreply.github.com> Date: Fri, 17 Mar 2023 11:34:19 +0200 Subject: [PATCH 02/58] Creating test for _dbconnect function of SQLite fixing the file path issue by identifying its type to String - testing it(Passed) --- .vscode/extensions.json | 5 +++++ .vscode/settings.json | 0 src/sqlite.jl | 6 +++--- test/runtests.jl | 5 +++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c494538 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "julialang.language-julia" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e69de29 diff --git a/src/sqlite.jl b/src/sqlite.jl index a35d5ad..04b0fcc 100644 --- a/src/sqlite.jl +++ b/src/sqlite.jl @@ -1,5 +1,5 @@ -function _dbconnect(connector::Type{SQLite.DB}; file_path) - - return connector(file_path.second) +function _dbconnect(connector::Type{SQLite.DB}, file_path::String) + return connector(file_path) + end diff --git a/test/runtests.jl b/test/runtests.jl index 35f99ea..c9684dd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,3 +2,8 @@ using Test, Example @test hello("Julia") == "Hello, Julia" @test domath(2.0) ≈ 7.0 + +@testset "_dbconnect function for SQLite" begin + conn= _dbconnect(SQLite.DB, "path_to_database.db") + @test @isdefined conn +end From ccb0995fbbf49a629494a6047f4972d26dc967f7 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Fri, 17 Mar 2023 11:44:52 +0200 Subject: [PATCH 03/58] fixing the file_path issue --- src/sqlite.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sqlite.jl b/src/sqlite.jl index 04b0fcc..d2cccd5 100644 --- a/src/sqlite.jl +++ b/src/sqlite.jl @@ -1,5 +1,6 @@ + function _dbconnect(connector::Type{SQLite.DB}, file_path::String) return connector(file_path) - + end From 9f01623cec4e6df7671acf13d7fb899734965a4c Mon Sep 17 00:00:00 2001 From: Farreeda Date: Fri, 17 Mar 2023 11:59:46 +0200 Subject: [PATCH 04/58] . --- src/sqlite.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sqlite.jl b/src/sqlite.jl index d2cccd5..db31dd4 100644 --- a/src/sqlite.jl +++ b/src/sqlite.jl @@ -1,4 +1,3 @@ - function _dbconnect(connector::Type{SQLite.DB}, file_path::String) return connector(file_path) From 8c812300686ceccfd05a24651cf5abf2dbccd488 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Sat, 18 Mar 2023 08:20:19 +0200 Subject: [PATCH 05/58] updating PR removed .vscode folder added --- .vscode/extensions.json | 5 ----- .vscode/settings.json => test/data/database.db | 0 test/runtests.jl | 4 +++- 3 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 .vscode/extensions.json rename .vscode/settings.json => test/data/database.db (100%) diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index c494538..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "recommendations": [ - "julialang.language-julia" - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/test/data/database.db similarity index 100% rename from .vscode/settings.json rename to test/data/database.db diff --git a/test/runtests.jl b/test/runtests.jl index c9684dd..1b944cb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,8 @@ using Test, Example @test domath(2.0) ≈ 7.0 @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "path_to_database.db") + + conn= _dbconnect(SQLite.DB, "DBConnector.jl/test/data/database.db") @test @isdefined conn + end From 120f262fdc00289d32fcd5791c3ee32f799375ef Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 00:55:52 +0300 Subject: [PATCH 06/58] with github secrets --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e978134..e61d288 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,32 @@ jobs: - uses: codecov/codecov-action@v1 with: file: lcov.info + job1: + ## The type of runner that the job will run on, + ## here it runs on ubuntu latest + runs-on: ubuntu-latest + steps: + - name: step 1 + ## Reference your environment variables + run: echo "The mysqlport is:${{secrets.MYSQL_PORT}}mysqluser:${{secrets.MYSQL_USER}} + mysqlhost:${{secrets.MYSQL_HOST}} + mysqlpassword:${{secrets.MYSQL_PASSWORD}} + postgresuser:${{secrets.POSTGRES_USER}} + postgreshost:${{secrets.POSTGRES_HOST}} + postgresport:${{secrets.POSTGRES_PORT}} + postgrespassword:${{secrets.POSTGRES_PASSWORD}}" + job2: + runs-on: ubuntu-latest + steps: + - name: step 1 + ## Another way reference your environment variables + run: echo "The mysqlport is:${{secrets.MYSQL_PORT}}mysqluser:${{secrets.MYSQL_USER}} + mysqlhost:${{secrets.MYSQL_HOST}} + mysqlpassword:${{secrets.MYSQL_PASSWORD}} + postgresuser:${{secrets.POSTGRES_USER}} + postgreshost:${{secrets.POSTGRES_HOST}} + postgresport:${{secrets.POSTGRES_PORT}} + postgrespassword:${{secrets.POSTGRES_PASSWORD}}" docs: name: Documentation runs-on: ubuntu-latest From 031dc3c084070bb707b6cc3b8948aa62b5e24d95 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 00:59:18 +0300 Subject: [PATCH 07/58] back to original --- .github/workflows/ci.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e61d288..e978134 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,32 +50,6 @@ jobs: - uses: codecov/codecov-action@v1 with: file: lcov.info - job1: - ## The type of runner that the job will run on, - ## here it runs on ubuntu latest - runs-on: ubuntu-latest - steps: - - name: step 1 - ## Reference your environment variables - run: echo "The mysqlport is:${{secrets.MYSQL_PORT}}mysqluser:${{secrets.MYSQL_USER}} - mysqlhost:${{secrets.MYSQL_HOST}} - mysqlpassword:${{secrets.MYSQL_PASSWORD}} - postgresuser:${{secrets.POSTGRES_USER}} - postgreshost:${{secrets.POSTGRES_HOST}} - postgresport:${{secrets.POSTGRES_PORT}} - postgrespassword:${{secrets.POSTGRES_PASSWORD}}" - job2: - runs-on: ubuntu-latest - steps: - - name: step 1 - ## Another way reference your environment variables - run: echo "The mysqlport is:${{secrets.MYSQL_PORT}}mysqluser:${{secrets.MYSQL_USER}} - mysqlhost:${{secrets.MYSQL_HOST}} - mysqlpassword:${{secrets.MYSQL_PASSWORD}} - postgresuser:${{secrets.POSTGRES_USER}} - postgreshost:${{secrets.POSTGRES_HOST}} - postgresport:${{secrets.POSTGRES_PORT}} - postgrespassword:${{secrets.POSTGRES_PASSWORD}}" docs: name: Documentation runs-on: ubuntu-latest From d5091eee21367c633044d2e9c0719ed74ce0ac22 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 02:59:38 +0300 Subject: [PATCH 08/58] . --- test/runtests.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 1b944cb..90781e8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,5 @@ -using Test, Example +using Test -@test hello("Julia") == "Hello, Julia" -@test domath(2.0) ≈ 7.0 @testset "_dbconnect function for SQLite" begin From fa480765eb160351c8ec739d6744c6a50e981555 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 03:15:24 +0300 Subject: [PATCH 09/58] updating the path --- test/data/{database.db => SQLite.db} | 0 test/runtests.jl | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename test/data/{database.db => SQLite.db} (100%) diff --git a/test/data/database.db b/test/data/SQLite.db similarity index 100% rename from test/data/database.db rename to test/data/SQLite.db diff --git a/test/runtests.jl b/test/runtests.jl index 90781e8..6b7ca70 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ using Test @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "DBConnector.jl/test/data/database.db") + conn= _dbconnect(SQLite.DB, "DBConnector/DBConnector.jl/test/data/SQLite.db") @test @isdefined conn end From 2760adc5a20e275ff6c64308764f0bb4c0b68924 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 03:35:45 +0300 Subject: [PATCH 10/58] Added quering --- test/data/SQLite.db | Bin 0 -> 8192 bytes test/runtests.jl | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/data/SQLite.db b/test/data/SQLite.db index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4f7deb1a3a8ce5f975dd8692f8fac1ce66dab8be 100644 GIT binary patch literal 8192 zcmeI#J5B>J5C-6x%}P{}(;&13Xb?@1A{s8h1}u~ZA$VPog2E9FS&3asuovJcT!=GJ z(sBd5By>o$6#p-K#;@w@T-;2{#>*-^Rj!d!>Jc-Yi4ak;ow0p~V@g191=j=go2ZH}9x7QlIKQHUt6? zfB*y_009U<00Izz00bZafqyU1>!ftV!?2WbSl7>??yDrFLms=@OHq~0I_q*u``lj3 HMeqk-2pTcZ literal 0 HcmV?d00001 diff --git a/test/runtests.jl b/test/runtests.jl index 6b7ca70..b61266c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,9 +1,15 @@ -using Test +using Test, DataFrames @testset "_dbconnect function for SQLite" begin conn= _dbconnect(SQLite.DB, "DBConnector/DBConnector.jl/test/data/SQLite.db") @test @isdefined conn + DBInterface.execute(conn, "CREATE TABLE PERSON (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)") + DBInterface.execute(conn, "INSERT INTO PERSON (name, age) VALUES ('John Doe', 30), ('Jane Smith', 25), ('Bob Johnson', 40)") + output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe'") |> DataFrame + out = output[1,1] + expected_output = 30; + @test out == expected_output end From f6e27dbff3bcedf248d4310f0344f4280151f8a5 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 03:42:41 +0300 Subject: [PATCH 11/58] removing database in the test --- test/data/SQLite.db | Bin 8192 -> 0 bytes test/runtests.jl | 2 ++ 2 files changed, 2 insertions(+) delete mode 100644 test/data/SQLite.db diff --git a/test/data/SQLite.db b/test/data/SQLite.db deleted file mode 100644 index 4f7deb1a3a8ce5f975dd8692f8fac1ce66dab8be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeI#J5B>J5C-6x%}P{}(;&13Xb?@1A{s8h1}u~ZA$VPog2E9FS&3asuovJcT!=GJ z(sBd5By>o$6#p-K#;@w@T-;2{#>*-^Rj!d!>Jc-Yi4ak;ow0p~V@g191=j=go2ZH}9x7QlIKQHUt6? zfB*y_009U<00Izz00bZafqyU1>!ftV!?2WbSl7>??yDrFLms=@OHq~0I_q*u``lj3 HMeqk-2pTcZ diff --git a/test/runtests.jl b/test/runtests.jl index b61266c..6b18ae2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,5 +11,7 @@ using Test, DataFrames out = output[1,1] expected_output = 30; @test out == expected_output + db_path = "DBConnector/DBConnector.jl/test/data/SQLite.db" + rm(db_path) end From 535ff8b3fcffcc3ed1b9e0c00ec07144d4daac84 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 03:48:23 +0300 Subject: [PATCH 12/58] updates --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 6b18ae2..42c0838 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ using Test, DataFrames @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "DBConnector/DBConnector.jl/test/data/SQLite.db") + conn= _dbconnect(SQLite.DB, "DBConnector/DBConnector.jl/test/data/sqlite.db") @test @isdefined conn DBInterface.execute(conn, "CREATE TABLE PERSON (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)") DBInterface.execute(conn, "INSERT INTO PERSON (name, age) VALUES ('John Doe', 30), ('Jane Smith', 25), ('Bob Johnson', 40)") @@ -11,7 +11,7 @@ using Test, DataFrames out = output[1,1] expected_output = 30; @test out == expected_output - db_path = "DBConnector/DBConnector.jl/test/data/SQLite.db" + db_path = "DBConnector/DBConnector.jl/test/data/sqlite.db" rm(db_path) end From 0e92556f6efdfeb24b7455ff6e2d41ed38813503 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 03:57:26 +0300 Subject: [PATCH 13/58] Adding Dataframes and examples --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 42c0838..8ee8420 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ using Test, DataFrames @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "DBConnector/DBConnector.jl/test/data/sqlite.db") + conn= _dbconnect(SQLite.DB, "DBConnector.jl/test/data/sqlite.db") @test @isdefined conn DBInterface.execute(conn, "CREATE TABLE PERSON (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)") DBInterface.execute(conn, "INSERT INTO PERSON (name, age) VALUES ('John Doe', 30), ('Jane Smith', 25), ('Bob Johnson', 40)") @@ -11,7 +11,7 @@ using Test, DataFrames out = output[1,1] expected_output = 30; @test out == expected_output - db_path = "DBConnector/DBConnector.jl/test/data/sqlite.db" + db_path = "DBConnector.jl/test/data/sqlite.db" rm(db_path) end From 766149ad182a2590d0879056e3b18c252ac1c547 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 04:03:51 +0300 Subject: [PATCH 14/58] . --- Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Project.toml b/Project.toml index e73cf82..a4d780c 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,8 @@ version = "1.0.0" [deps] DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965" +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +Example = "7876af07-990d-54b4-ab0e-23690620f79a" JDBC = "6042db11-3c3d-5e84-8dba-9cbf74c9ba48" LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" MySQL = "39abe10b-433b-5dbd-92d4-e302a9df00cd" From 43b80c507661a7646db86a4faf57a8bddefd9f5e Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 04:10:47 +0300 Subject: [PATCH 15/58] . --- docs/make.jl | 6 +++--- test/runtests.jl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index fd29b00..11e840f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,5 +1,5 @@ -using Documenter, Example +#using Documenter, Example -makedocs(modules = [Example], sitename = "Example.jl") +#makedocs(modules = [Example], sitename = "Example.jl") -deploydocs(repo = "github.com/quinnj/Example.jl.git", push_preview = true) +#deploydocs(repo = "github.com/quinnj/Example.jl.git", push_preview = true) diff --git a/test/runtests.jl b/test/runtests.jl index 8ee8420..220802d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using Test, DataFrames +using Test, DataFrames, SQLite @testset "_dbconnect function for SQLite" begin From 6152c9d79eff21a6a2bfce735794da7cb4908482 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 04:25:12 +0300 Subject: [PATCH 16/58] allowing the test to access the function for the workflow --- src/sqlite.jl | 2 ++ test/runtests.jl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sqlite.jl b/src/sqlite.jl index db31dd4..08fce44 100644 --- a/src/sqlite.jl +++ b/src/sqlite.jl @@ -1,3 +1,5 @@ +export _dbconnect + function _dbconnect(connector::Type{SQLite.DB}, file_path::String) return connector(file_path) diff --git a/test/runtests.jl b/test/runtests.jl index 220802d..24ea55b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using Test, DataFrames, SQLite - +include("DBConnector.jl/src/sqlite.jl") @testset "_dbconnect function for SQLite" begin From 106173a763c9b4ad3e7e6595a3e6bb7cfb85af75 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 04:32:11 +0300 Subject: [PATCH 17/58] add / for absolute path :) --- src/sqlite.jl | 1 + test/runtests.jl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sqlite.jl b/src/sqlite.jl index 08fce44..5c6bbb1 100644 --- a/src/sqlite.jl +++ b/src/sqlite.jl @@ -1,3 +1,4 @@ +using SQLite export _dbconnect function _dbconnect(connector::Type{SQLite.DB}, file_path::String) diff --git a/test/runtests.jl b/test/runtests.jl index 24ea55b..2e10782 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using Test, DataFrames, SQLite -include("DBConnector.jl/src/sqlite.jl") +include("/DBConnector.jl/src/sqlite.jl") @testset "_dbconnect function for SQLite" begin From 967e798b6afb5f61c5f302d74d1fe76d97806388 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 04:39:42 +0300 Subject: [PATCH 18/58] . --- test/data/sqlite.db | Bin 0 -> 8192 bytes test/runtests.jl | 4 ---- 2 files changed, 4 deletions(-) create mode 100644 test/data/sqlite.db diff --git a/test/data/sqlite.db b/test/data/sqlite.db new file mode 100644 index 0000000000000000000000000000000000000000..7c5d231d4def11db5fbf090953dcfd7db332e677 GIT binary patch literal 8192 zcmeI#J5B>J5C-6x%}P{}(;&13Xb?@1A{s8h1}u~ZA$VPog2EAoEMnIZ>;*Uq7eX9? zD{uq6By>o$6#p-K#;@w@TwG1d#>-uJs$3(-)FWm(5h0>vGh_P>$C_@|ZEN>`C848- z_ilW}>XqU^AOHafKmY;|fB*y_009U<00I#BP2h&NcCw6Lwi~y6^mA>B%h|dnr$*;i zi_M2qE$cJsm$x#SS$(dJ%+2T`Hw&5Q#XxFTd9nK14#eI2pErl?-@K#VNPVi0*boRn z00Izz00bZa0SG_<0uX=z1pd81uanXN55rQ%VO2key04Oy_Id1TFGW>0tE|f@?Q(l9 IXTk4%0gtUQy8r+H literal 0 HcmV?d00001 diff --git a/test/runtests.jl b/test/runtests.jl index 2e10782..e0a750a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,13 +5,9 @@ include("/DBConnector.jl/src/sqlite.jl") conn= _dbconnect(SQLite.DB, "DBConnector.jl/test/data/sqlite.db") @test @isdefined conn - DBInterface.execute(conn, "CREATE TABLE PERSON (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)") - DBInterface.execute(conn, "INSERT INTO PERSON (name, age) VALUES ('John Doe', 30), ('Jane Smith', 25), ('Bob Johnson', 40)") output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe'") |> DataFrame out = output[1,1] expected_output = 30; @test out == expected_output - db_path = "DBConnector.jl/test/data/sqlite.db" - rm(db_path) end From 421f10d384fc47458781ba94633ff0fc710d3371 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 04:41:35 +0300 Subject: [PATCH 19/58] . --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index e0a750a..9ac3fd1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ include("/DBConnector.jl/src/sqlite.jl") @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "DBConnector.jl/test/data/sqlite.db") + conn= _dbconnect(SQLite.DB, "/DBConnector.jl/test/data/sqlite.db") @test @isdefined conn output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe'") |> DataFrame out = output[1,1] From 5eadd8e4e056f1302d08d9dda0dc20d2fd1433cc Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 05:05:58 +0300 Subject: [PATCH 20/58] . --- src/sqlite.jl | 1 - test/runtests.jl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sqlite.jl b/src/sqlite.jl index 5c6bbb1..8295f37 100644 --- a/src/sqlite.jl +++ b/src/sqlite.jl @@ -1,5 +1,4 @@ using SQLite -export _dbconnect function _dbconnect(connector::Type{SQLite.DB}, file_path::String) diff --git a/test/runtests.jl b/test/runtests.jl index 9ac3fd1..153b2da 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using Test, DataFrames, SQLite -include("/DBConnector.jl/src/sqlite.jl") +include("DBConnector.jl/src/sqlite.jl") @testset "_dbconnect function for SQLite" begin From 2d1ed6cfcab1aec7e96b5a571dcd514114990fa7 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 05:11:55 +0300 Subject: [PATCH 21/58] path problems --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 153b2da..9255311 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using Test, DataFrames, SQLite -include("DBConnector.jl/src/sqlite.jl") +include("../DBConnector.jl/src/sqlite.jl") @testset "_dbconnect function for SQLite" begin From fc02a02183b52e7c58957f02d233369c2c7e3fde Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 05:18:19 +0300 Subject: [PATCH 22/58] . --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 9255311..f512acb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,9 +1,9 @@ using Test, DataFrames, SQLite -include("../DBConnector.jl/src/sqlite.jl") +include("../src/sqlite.jl") @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "/DBConnector.jl/test/data/sqlite.db") + conn= _dbconnect(SQLite.DB, "/data/sqlite.db") @test @isdefined conn output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe'") |> DataFrame out = output[1,1] From fdef69c2f0b5c0e2dca4f15958e7248149e33e8f Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 05:25:59 +0300 Subject: [PATCH 23/58] . --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index f512acb..71c52f9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ include("../src/sqlite.jl") @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "/data/sqlite.db") + conn= _dbconnect(SQLite.DB, "../test/data/sqlite.db") @test @isdefined conn output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe'") |> DataFrame out = output[1,1] From b18efea0211a69e8c255e5f6d5c351f56251ec69 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 06:04:12 +0300 Subject: [PATCH 24/58] testing mysql and postgresql #1 testing the github secrets --- .github/workflows/ci.yml | 11 +++++++++++ src/mysql.jl | 7 +++++-- src/postgresql.jl | 3 ++- test/runtests.jl | 22 ++++++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e978134..a4857e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,17 @@ jobs: ${{ runner.os }}- - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + env: + + POSTGRES_USER = {{secrets.POSTGRES_USER}} + POSTGRES_HOST = {{secrets.POSTGRES_HOST}} + POSTGRES_PORT = {{secrets.POSTGRES_PORT}} + POSTGRES_PASSWORD = {{secrets.POSTGRES_PASSWORD}} + MYSQL_USER = {{secrets.MYSQL_USER}} + MYSQL_HOST = {{secrets.MYSQL_HOST}} + MYSQL_PORT = {{secrets.MYSQL_PORT}} + MYSQL_PASSWORD = {{secrets.MYSQL_PASSWORD}} + - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: diff --git a/src/mysql.jl b/src/mysql.jl index 151c87e..0075238 100644 --- a/src/mysql.jl +++ b/src/mysql.jl @@ -1,5 +1,8 @@ -function _dbconnect(conn_obj::Type{MySQL.Connection}, kwargs) +function _dbconnect(conn_obj::Type{MySQL.Connection}, host::String, user::String, password::String; db::String="", port::Integer=3306, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) - return DBInterface.connect(conn_obj; kwargs...) + if unix_socket == nothing + unix_socket = API.MYSQL_DEFAULT_SOCKET + end + return DBInterface.connect(conn_obj,host, user, password, db=db, port=port, unix_socket=unix_socket, client_flag=client_flag, opts=opts ) end diff --git a/src/postgresql.jl b/src/postgresql.jl index 7eb6293..32563d0 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -4,7 +4,8 @@ Dispatch for LibPQ interface to DBInterface `connect` function; not supported in DBInterface.connect(::Type{LibPQ.Connection}, args...; kws...) = LibPQ.Connection(args...; kws...) -function _dbconnect(conn_obj::Type{LibPQ.Connection}; kwargs...) +function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String; db::String="", port::Integer=5432, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) + conn_string = "" for k in kwargs conn_string = conn_string * "$(string(k.first))=$(k.second) " diff --git a/test/runtests.jl b/test/runtests.jl index 71c52f9..61fa815 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,10 @@ using Test, DataFrames, SQLite +using MySQL,SQLite, MySQL.API, LibPQ + + include("../src/sqlite.jl") +include("../src/mysql.jl") +include("../src/postgresql.jl") @testset "_dbconnect function for SQLite" begin @@ -11,3 +16,20 @@ include("../src/sqlite.jl") @test out == expected_output end + +@testset "_dbconnect function for MySQL" begin + + conn = _dbconnect(MySQL.Connection, ENV['MYSQL_HOST'], ENV['MYSQL_USER'], ENV['MYSQL_PASSWORD'], db="MySQL") + + @test typeof(conn) == MySQL.Connection + @test isopen(conn) + close(conn) + +end + +@testset "_dbconnect function for LibPQ" begin + + conn= _dbconnect(LibPQ.Connection, ENV['POSTGRES_HOST'], ENV['POSTGRES_USER'], ENV['POSTGRES_PASSWORD'], db = "mimic") + @test @isdefined conn + +end \ No newline at end of file From 6cf9c35ce44c67cacdcd7dddf787bfa2bf4b57ea Mon Sep 17 00:00:00 2001 From: Farreeda Date: Mon, 3 Jul 2023 07:25:20 +0300 Subject: [PATCH 25/58] initial documentation --- docs/make.jl | 32 ++++++++++++-- docs/src/Tutorials/MySQL.md | 73 ++++++++++++++++++++++++++++++++ docs/src/Tutorials/SQLite.md | 49 +++++++++++++++++++++ docs/src/Tutorials/postgreSQL.md | 73 ++++++++++++++++++++++++++++++++ docs/src/index.md | 21 ++++++--- docs/src/tutorials.md | 11 +++++ 6 files changed, 251 insertions(+), 8 deletions(-) create mode 100644 docs/src/Tutorials/MySQL.md create mode 100644 docs/src/Tutorials/SQLite.md create mode 100644 docs/src/Tutorials/postgreSQL.md create mode 100644 docs/src/tutorials.md diff --git a/docs/make.jl b/docs/make.jl index 11e840f..f8f8f8b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,5 +1,31 @@ -#using Documenter, Example +using Documenter -#makedocs(modules = [Example], sitename = "Example.jl") +makedocs(; + modules = [DBConnector], + authors = "Jacob Zelko (aka TheCedarPrince) and contributors", + repo = "https://github.com/JuliaHealth/DBConnector.jl/blob/{commit}{path}#L{line}", + sitename = "DBConnector.jl", + format = Documenter.HTML(; + prettyurls = get(ENV, "CI", "false") == "true", + canonical = "https://JuliaHealth.github.io/DBConnector.jl", + assets = String[], + edit_link = "dev", + footer = "Created by [Jacob Zelko](https://jacobzelko.com) & [Georgia Tech Research Institute](https://www.gtri.gatech.edu). [License](https://github.com/JuliaHealth/OMOPCDMCohortCreator.jl/blob/main/LICENSE)" + ), + pages = [ + "Home" => "index.md", + "Tutorials" => [ + "SQLite.md", + "MySQL.md", + "postgreSQL.md" + ], + "API" => "api.md", + "Contributing" => "contributing.md" + ], +) -#deploydocs(repo = "github.com/quinnj/Example.jl.git", push_preview = true) +deploydocs(; + repo = "github.com/JuliaHealth/DBConnector.jl", + push_preview = true, + devbranch = "main", +) \ No newline at end of file diff --git a/docs/src/Tutorials/MySQL.md b/docs/src/Tutorials/MySQL.md new file mode 100644 index 0000000..66a5315 --- /dev/null +++ b/docs/src/Tutorials/MySQL.md @@ -0,0 +1,73 @@ +# MySQL Connection Tutorial + +```@contents +Pages = ["MySQL.md"] +``` + +This tutorial presents a step by step guide on using DBConnector to connect a MySQL database. + +### Prerequisites + +Basic knowledge of Julia (such as installing packages into environments and working with the Julia REPL and Julia files) is necessary; you can learn all [that here](https://pkgdocs.julialang.org/v1/getting-started/). + +Get your database's : + + 1- username + 2- password + 3- host + 5- Database name + + optional: + - port (3306 by default) + - unix_socket + - client_flag + - opts=opts + + +## Environment Set-Up + +For this tutorial, you will need to activate an environment; to get into package mode within your Julia REPL, write `]`: + +```julia-repl +pkg> activate TUTORIAL +``` + + +### Packages + + + +You will need the following packages for this tutorial which you can install in package mode: + +"]" sets package mode + +```julia-repl +TUTORIAL> add DBConnector +``` + +"Backspace" to return to Julia mode + +``` +using DBConnector + +conn= _dbconnect(MySQL.Connection, host, user, password, db=db) + +``` +In case you want to use the optional strings: + +``` +using DBConnector + +conn= _dbconnect(MySQL.Connection, host, user, password, db="the database name", port = 3306, unix_socket=unix_socket, client_flag=client_flag, opts=opts ) + +``` + +Now you are connected! + +Note: It produces error only in case the path is incorrect credentials + +### Packages Used in Analysis + +Package descriptions: + +- [`SQLite`](https://github.com/JuliaDatabases/SQLite.jl) - A Julia interface to the SQLite library \ No newline at end of file diff --git a/docs/src/Tutorials/SQLite.md b/docs/src/Tutorials/SQLite.md new file mode 100644 index 0000000..81e9a07 --- /dev/null +++ b/docs/src/Tutorials/SQLite.md @@ -0,0 +1,49 @@ +# SQLite Connection Tutorial + +```@contents +Pages = ["SQLite.md"] +``` + +This tutorial presents a step by step guide on using DBConnector to connect a SQLite database. + +### Prerequisites + +Basic knowledge of Julia (such as installing packages into environments and working with the Julia REPL and Julia files) is necessary; you can learn all [that here](https://pkgdocs.julialang.org/v1/getting-started/). + +Get your database's file path + +## Environment Set-Up + +For this tutorial, you will need to activate an environment; to get into package mode within your Julia REPL, write `]`: + +```julia-repl +pkg> activate TUTORIAL +``` + + +### Packages + + + +You will need the following packages for this tutorial which you can install in package mode: + +"]" sets package mode + +```julia-repl +TUTORIAL> add DBConnector +``` + +"Backspace" to return to Julia mode + +``` +conn= _dbconnect(SQLite.DB, "../test/data/sqlite.db") +``` +Now you are connected! and if the file wasn't exist it will be created! + +Note: It produces error only in case the path is incorrect + +### Packages Used in Analysis + +Package descriptions: + +- [`SQLite`](https://github.com/JuliaDatabases/SQLite.jl) - A Julia interface to the SQLite library \ No newline at end of file diff --git a/docs/src/Tutorials/postgreSQL.md b/docs/src/Tutorials/postgreSQL.md new file mode 100644 index 0000000..09abc3d --- /dev/null +++ b/docs/src/Tutorials/postgreSQL.md @@ -0,0 +1,73 @@ +# PostgreSQL Connection Tutorial + +```@contents +Pages = ["PostgreSQL.md"] +``` + +This tutorial presents a step by step guide on using DBConnector to connect to PostgreSQL database using LibPQ library. + +### Prerequisites + +Basic knowledge of Julia (such as installing packages into environments and working with the Julia REPL and Julia files) is necessary; you can learn all [that here](https://pkgdocs.julialang.org/v1/getting-started/). + +Get your database's : + + 1- username + 2- password + 3- host + 5- Database name + + optional: + - port (5432 by default) + - unix_socket + - client_flag + - opts=opts + + +## Environment Set-Up + +For this tutorial, you will need to activate an environment; to get into package mode within your Julia REPL, write `]`: + +```julia-repl +pkg> activate TUTORIAL +``` + + +### Packages + + + +You will need the following packages for this tutorial which you can install in package mode: + +"]" sets package mode + +```julia-repl +TUTORIAL> add DBConnector +``` + +"Backspace" to return to Julia mode + +``` +using DBConnector + +conn= _dbconnect(LibPQ.Connection, host, user, password, db=db) + +``` +In case you want to use the optional strings: + +``` +using DBConnector + +conn= _dbconnect(LibPQ.Connection, host, user, password, db="the database name", port = 5432, unix_socket=unix_socket, client_flag=client_flag, opts=opts ) + +``` + +Now you are connected! + +Note: It produces error only in case the path is incorrect credentials + +### Packages Used in Analysis + +Package descriptions: + +- [`LibPQ`](https://github.com/chris-b1/LibPQ.jl#dbinterface) - A Julia interface to the LibPQ library \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md index b1cee35..b29e1e4 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,7 +1,18 @@ -# Example +# Welcome to the `DBConnector.jl` Docs + +> Get your credentials and connect to databases in one step with DBConnector! + + +To get started, visit the section as well as visit the visit the [Tutorials](@ref) section to see all the functions available. +If you want to contribute, please check out our guide! + +## Main Features 🔧 + +The biggest features of this package are: + + - "SQLite" functions [SQLite](@ref) a database + - "MySQL" functions to [MySQL](@ref) a database + - "PostgreSQL" functions to [postgreSQL](@ref) database connections + -Example Julia package repo. -```@autodocs -Modules = [Example] -``` diff --git a/docs/src/tutorials.md b/docs/src/tutorials.md new file mode 100644 index 0000000..a8a4cff --- /dev/null +++ b/docs/src/tutorials.md @@ -0,0 +1,11 @@ +# Tutorials + +```@contents +Pages = ["tutorials.md"] +``` + +These tutorials are designed to equip new users with how to get started with DBConnector + + - "SQLite" functions [SQLite](@ref) a database + - "MySQL" functions to [MySQL](@ref) a database + - "PostgreSQL" functions to [postgreSQL](@ref) database connections \ No newline at end of file From d5d8fc81ac7c1e94ee1bb96dbf46817172e95ed5 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 14:10:12 -0400 Subject: [PATCH 26/58] Cleaned workflow syntax --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4857e1..14f3704 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,6 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 env: - POSTGRES_USER = {{secrets.POSTGRES_USER}} POSTGRES_HOST = {{secrets.POSTGRES_HOST}} POSTGRES_PORT = {{secrets.POSTGRES_PORT}} @@ -56,7 +55,6 @@ jobs: MYSQL_HOST = {{secrets.MYSQL_HOST}} MYSQL_PORT = {{secrets.MYSQL_PORT}} MYSQL_PASSWORD = {{secrets.MYSQL_PASSWORD}} - - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: From 68060cdeb0ef6bc73188f89a3210aa73746bd335 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 14:10:30 -0400 Subject: [PATCH 27/58] Removed test dependencies and put them into test dependencies --- Project.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Project.toml b/Project.toml index a4d780c..04e0fd2 100644 --- a/Project.toml +++ b/Project.toml @@ -4,12 +4,8 @@ version = "1.0.0" [deps] DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965" -DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -Example = "7876af07-990d-54b4-ab0e-23690620f79a" -JDBC = "6042db11-3c3d-5e84-8dba-9cbf74c9ba48" LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" MySQL = "39abe10b-433b-5dbd-92d4-e302a9df00cd" -ODBC = "be6f12e9-ca4f-5eb2-a339-a4f995cc0291" SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" [compat] From b859b4cbaa2a2e7724ca2d1b252e883522f48fd7 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 14:52:48 -0400 Subject: [PATCH 28/58] Added author names and comapt and removed test dependencies --- Project.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 04e0fd2..8c260f7 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "DBConnector" uuid = "5242bac9-aa14-4800-b46b-fcd14df13057" -version = "1.0.0" +version = "0.1.0" [deps] DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965" @@ -9,6 +9,10 @@ MySQL = "39abe10b-433b-5dbd-92d4-e302a9df00cd" SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" [compat] +DBInterface = "2.5" +LibPQ = "1.15" +MySQL = "1.4" +SQLite = "1.6" julia = "1.6" [extras] From 8cc149234ec12394bac9aaf1cb51aaad32495984 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:01:40 -0400 Subject: [PATCH 29/58] Deprecated ODBC JDBC and their dispatch --- src/DBConnector.jl | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/DBConnector.jl b/src/DBConnector.jl index 2fa46b1..852175f 100644 --- a/src/DBConnector.jl +++ b/src/DBConnector.jl @@ -3,15 +3,11 @@ module DBConnector using DBInterface using LibPQ using SQLite -using ODBC -using JDBC using MySQL include("postgresql.jl") include("sqlite.jl") include("mysql.jl") -include("odbc.jl") -include("jdbc.jl") function DBConnection(dbms; kws...) @@ -25,17 +21,6 @@ function DBConnection(dbms; kws...) end -function DBConnection(;driver_path, connection_string, connectivity, kws...) - - if lowercase(connectivity) == "odbc" - _odbcconnect(connection_string, ; kws...) - elseif lowercase(connectivity) == "jdbc" - _jdbcconnect(driver_path, connection_string, ; kws...) - else - println("Connection not made; please specify if this is an JDBC or ODBC connection") - end -end - export DBConnection end From 44544a2f050bce75246a32f68557f338d22541e0 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:02:40 -0400 Subject: [PATCH 30/58] Removed ODBC JDBC functions --- src/jdbc.jl | 46 ---------------------------------------------- src/odbc.jl | 11 ----------- 2 files changed, 57 deletions(-) delete mode 100644 src/jdbc.jl delete mode 100644 src/odbc.jl diff --git a/src/jdbc.jl b/src/jdbc.jl deleted file mode 100644 index 51b6eb8..0000000 --- a/src/jdbc.jl +++ /dev/null @@ -1,46 +0,0 @@ -""" -Dispatch for JDBC interface to DBInterface `connect` function -""" -function DBInterface.connect(::Type{JDBC.Connection}, args...; connection_string, driver, kws...) - JDBC.usedriver(driver) - try - JDBC.init() - catch - println("JVM already initialized") - end - JDBC.DriverManager.getConnection(connection_string) -end - -""" -Dispatch for JDBC interface to DBInterface `prepare` function -BUG: Doesn't seem to work for all JDBC versions yet -""" -function DBInterface.prepare(conn::JDBC.JavaObject{Symbol("java.sql.Connection")}, args...; kws...) - stmt = JDBC.createStatement(conn) - result = executeQuery(stmt, args...) - return result -end - -""" -Workaround for JDBC interface to DBInterface's `execute` function -""" -function DBInterface.execute(conn::JDBC.JavaObject{Symbol("java.sql.ResultSet")}, args...; kws...) - JDBC.Source(conn) -end - -""" -Workaround for JDBC interface to DBInterface's `execute` function -""" -function DBInterface.execute(conn::JDBC.JavaObject{Symbol("java.sql.Connection")}, args...; kws...) - stmt = JDBC.createStatement(conn) - result = executeQuery(stmt, args...) - JDBC.Source(result) -end - - -function _jdbcconnect(driver_path, connection_string; kws...) - - return DBInterface.connect(JDBC.Connection, driver = driver_path, connection_string = connection_string) - -end - diff --git a/src/odbc.jl b/src/odbc.jl deleted file mode 100644 index 5f77785..0000000 --- a/src/odbc.jl +++ /dev/null @@ -1,11 +0,0 @@ -function _odbcconnect(driver_path; kwargs...) - - ODBC.adddriver("DBDRIVER", driver_path) - conn_string = "Driver=DBDRIVER;" - for k in kwargs - conn_string = conn_string * "$(string(k.first))=$(k.second);" - end - - return DBInterface.connect(ODBC.Connection, conn_string[1:end-1]) - -end From aadd240e639a20c8d32b471b31050bbca757fee2 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:02:54 -0400 Subject: [PATCH 31/58] Updated test suite to work properly --- test/runtests.jl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 61fa815..cae5db2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,16 +1,12 @@ using Test, DataFrames, SQLite using MySQL,SQLite, MySQL.API, LibPQ - - -include("../src/sqlite.jl") -include("../src/mysql.jl") -include("../src/postgresql.jl") +using DBConnector @testset "_dbconnect function for SQLite" begin - conn= _dbconnect(SQLite.DB, "../test/data/sqlite.db") + conn= DBConnector._dbconnect(SQLite.DB, "../test/data/sqlite.db") @test @isdefined conn - output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe'") |> DataFrame + output = DBInterface.execute(conn, "SELECT age FROM PERSON WHERE name = 'John Doe';") |> DataFrame out = output[1,1] expected_output = 30; @test out == expected_output @@ -19,7 +15,7 @@ end @testset "_dbconnect function for MySQL" begin - conn = _dbconnect(MySQL.Connection, ENV['MYSQL_HOST'], ENV['MYSQL_USER'], ENV['MYSQL_PASSWORD'], db="MySQL") + conn = DBConnector._dbconnect(MySQL.Connection, ENV["MYSQL_HOST"], ENV["MYSQL_USER"], ENV["MYSQL_PASSWORD"], db="MySQL") @test typeof(conn) == MySQL.Connection @test isopen(conn) @@ -29,7 +25,7 @@ end @testset "_dbconnect function for LibPQ" begin - conn= _dbconnect(LibPQ.Connection, ENV['POSTGRES_HOST'], ENV['POSTGRES_USER'], ENV['POSTGRES_PASSWORD'], db = "mimic") + conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"], ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], db = "mimic") @test @isdefined conn -end \ No newline at end of file +end From 993c107beff8e69d85813fd273541e4f33eb117e Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:05:00 -0400 Subject: [PATCH 32/58] Added test dependenices --- test/Manifest.toml | 555 +++++++++++++++++++++++++++++++++++++++++++++ test/Project.toml | 6 + 2 files changed, 561 insertions(+) create mode 100644 test/Manifest.toml create mode 100644 test/Project.toml diff --git a/test/Manifest.toml b/test/Manifest.toml new file mode 100644 index 0000000..daa7489 --- /dev/null +++ b/test/Manifest.toml @@ -0,0 +1,555 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.9.1" +manifest_format = "2.0" +project_hash = "209e080a85c8d66260678d06ee150de40b189cf0" + +[[deps.Adapt]] +deps = ["LinearAlgebra", "Requires"] +git-tree-sha1 = "76289dc51920fdc6e0013c872ba9551d54961c24" +uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" +version = "3.6.2" + + [deps.Adapt.extensions] + AdaptStaticArraysExt = "StaticArrays" + + [deps.Adapt.weakdeps] + StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" + +[[deps.ArgTools]] +uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.1" + +[[deps.Artifacts]] +uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" + +[[deps.Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" + +[[deps.CEnum]] +git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90" +uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" +version = "0.4.2" + +[[deps.Compat]] +deps = ["UUIDs"] +git-tree-sha1 = "4e88377ae7ebeaf29a047aa1ee40826e0b708a5d" +uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" +version = "4.7.0" +weakdeps = ["Dates", "LinearAlgebra"] + + [deps.Compat.extensions] + CompatLinearAlgebraExt = "LinearAlgebra" + +[[deps.CompilerSupportLibraries_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "1.0.2+0" + +[[deps.Crayons]] +git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" +uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" +version = "4.1.1" + +[[deps.DBInterface]] +git-tree-sha1 = "9b0dc525a052b9269ccc5f7f04d5b3639c65bca5" +uuid = "a10d1c49-ce27-4219-8d33-6db1a4562965" +version = "2.5.0" + +[[deps.DataAPI]] +git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c" +uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" +version = "1.15.0" + +[[deps.DataFrames]] +deps = ["Compat", "DataAPI", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] +git-tree-sha1 = "089d29c0fc00a190661517e4f3cba5dcb3fd0c08" +uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +version = "1.6.0" + +[[deps.DataStructures]] +deps = ["Compat", "InteractiveUtils", "OrderedCollections"] +git-tree-sha1 = "cf25ccb972fec4e4817764d01c82386ae94f77b4" +uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" +version = "0.18.14" + +[[deps.DataValueInterfaces]] +git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" +uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" +version = "1.0.0" + +[[deps.Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" + +[[deps.DecFP]] +deps = ["DecFP_jll", "Printf", "Random", "SpecialFunctions"] +git-tree-sha1 = "4a10cec664e26d9d63597daf9e62147e79d636e3" +uuid = "55939f99-70c6-5e9b-8bb0-5071ed7d61fd" +version = "1.3.2" + +[[deps.DecFP_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "e9a8da19f847bbfed4076071f6fef8665a30d9e5" +uuid = "47200ebd-12ce-5be5-abb7-8e082af23329" +version = "2.0.3+1" + +[[deps.Decimals]] +git-tree-sha1 = "e98abef36d02a0ec385d68cd7dadbce9b28cbd88" +uuid = "abce61dc-4473-55a0-ba07-351d65e31d42" +version = "0.4.1" + +[[deps.Distributed]] +deps = ["Random", "Serialization", "Sockets"] +uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" + +[[deps.DocStringExtensions]] +deps = ["LibGit2"] +git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" +uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" +version = "0.9.3" + +[[deps.Downloads]] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] +uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" + +[[deps.ExprTools]] +git-tree-sha1 = "c1d06d129da9f55715c6c212866f5b1bddc5fa00" +uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" +version = "0.1.9" + +[[deps.FileWatching]] +uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" + +[[deps.Formatting]] +deps = ["Printf"] +git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8" +uuid = "59287772-0a20-5a39-b81b-1366585eb4c0" +version = "0.4.2" + +[[deps.Future]] +deps = ["Random"] +uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" + +[[deps.Infinity]] +deps = ["Dates", "Random", "Requires"] +git-tree-sha1 = "cf8234411cbeb98676c173f930951ea29dca3b23" +uuid = "a303e19e-6eb4-11e9-3b09-cd9505f79100" +version = "0.2.4" + +[[deps.InlineStrings]] +deps = ["Parsers"] +git-tree-sha1 = "9cc2baf75c6d09f9da536ddf58eb2f29dedaf461" +uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" +version = "1.4.0" + +[[deps.InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" + +[[deps.Intervals]] +deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"] +git-tree-sha1 = "ac0aaa807ed5eaf13f67afe188ebc07e828ff640" +uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5" +version = "1.10.0" + +[[deps.InvertedIndices]] +git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038" +uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" +version = "1.3.0" + +[[deps.IrrationalConstants]] +git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" +uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" +version = "0.2.2" + +[[deps.IterTools]] +git-tree-sha1 = "4ced6667f9974fc5c5943fa5e2ef1ca43ea9e450" +uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" +version = "1.8.0" + +[[deps.IteratorInterfaceExtensions]] +git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" +uuid = "82899510-4779-5014-852e-03e436cf321d" +version = "1.0.0" + +[[deps.JLLWrappers]] +deps = ["Preferences"] +git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" +uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" +version = "1.4.1" + +[[deps.Kerberos_krb5_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "60274b4ab38e8d1248216fe6b6ace75ae09b0502" +uuid = "b39eb1a6-c29a-53d7-8c32-632cd16f18da" +version = "1.19.3+0" + +[[deps.LaTeXStrings]] +git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996" +uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" +version = "1.3.0" + +[[deps.LayerDicts]] +git-tree-sha1 = "6087ad3521d6278ebe5c27ae55e7bbb15ca312cb" +uuid = "6f188dcb-512c-564b-bc01-e0f76e72f166" +version = "1.0.0" + +[[deps.LazyArtifacts]] +deps = ["Artifacts", "Pkg"] +uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" + +[[deps.LibCURL]] +deps = ["LibCURL_jll", "MozillaCACerts_jll"] +uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.3" + +[[deps.LibCURL_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] +uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "7.84.0+0" + +[[deps.LibGit2]] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" + +[[deps.LibPQ]] +deps = ["CEnum", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "Infinity", "Intervals", "IterTools", "LayerDicts", "LibPQ_jll", "Libdl", "Memento", "OffsetArrays", "SQLStrings", "Tables", "TimeZones", "UTCDateTimes"] +git-tree-sha1 = "114d9d239ab8e1251354ad6bb97ed38622133114" +uuid = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" +version = "1.15.1" + +[[deps.LibPQ_jll]] +deps = ["Artifacts", "JLLWrappers", "Kerberos_krb5_jll", "Libdl", "OpenSSL_jll", "Pkg"] +git-tree-sha1 = "a299629703a93d8efcefccfc16b18ad9a073d131" +uuid = "08be9ffa-1c94-5ee5-a977-46a84ec9b350" +version = "14.3.0+1" + +[[deps.LibSSH2_jll]] +deps = ["Artifacts", "Libdl", "MbedTLS_jll"] +uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.10.2+0" + +[[deps.Libdl]] +uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" + +[[deps.Libiconv_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "c7cb1f5d892775ba13767a87c7ada0b980ea0a71" +uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" +version = "1.16.1+2" + +[[deps.LinearAlgebra]] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] +uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + +[[deps.LogExpFunctions]] +deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] +git-tree-sha1 = "c3ce8e7420b3a6e071e0fe4745f5d4300e37b13f" +uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" +version = "0.3.24" + + [deps.LogExpFunctions.extensions] + LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" + LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables" + LogExpFunctionsInverseFunctionsExt = "InverseFunctions" + + [deps.LogExpFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + +[[deps.Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" + +[[deps.MariaDB_Connector_C_jll]] +deps = ["Artifacts", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "Pkg", "Zlib_jll"] +git-tree-sha1 = "30523a011413b08ee38a6ed6a18e84c363d0ce79" +uuid = "aabc7e14-95f1-5e66-9f32-aea603782360" +version = "3.1.12+0" + +[[deps.Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[[deps.MbedTLS_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.28.2+0" + +[[deps.Memento]] +deps = ["Dates", "Distributed", "Requires", "Serialization", "Sockets", "Test", "UUIDs"] +git-tree-sha1 = "bb2e8f4d9f400f6e90d57b34860f6abdc51398e5" +uuid = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9" +version = "1.4.1" + +[[deps.Missings]] +deps = ["DataAPI"] +git-tree-sha1 = "f66bdc5de519e8f8ae43bdc598782d35a25b1272" +uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" +version = "1.1.0" + +[[deps.Mocking]] +deps = ["Compat", "ExprTools"] +git-tree-sha1 = "4cc0c5a83933648b615c36c2b956d94fda70641e" +uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" +version = "0.7.7" + +[[deps.MozillaCACerts_jll]] +uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2022.10.11" + +[[deps.MySQL]] +deps = ["DBInterface", "Dates", "DecFP", "Libdl", "MariaDB_Connector_C_jll", "Parsers", "Tables"] +git-tree-sha1 = "2f962011721ba26f3b3467b05610a08cfd2caff5" +uuid = "39abe10b-433b-5dbd-92d4-e302a9df00cd" +version = "1.4.3" + +[[deps.NetworkOptions]] +uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" + +[[deps.OffsetArrays]] +deps = ["Adapt"] +git-tree-sha1 = "2ac17d29c523ce1cd38e27785a7d23024853a4bb" +uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" +version = "1.12.10" + +[[deps.OpenBLAS_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] +uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" +version = "0.3.21+4" + +[[deps.OpenLibm_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "05823500-19ac-5b8b-9628-191a04bc5112" +version = "0.8.1+0" + +[[deps.OpenSSL_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1aa4b74f80b01c6bc2b89992b861b5f210e665b5" +uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" +version = "1.1.21+0" + +[[deps.OpenSpecFun_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" +uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" +version = "0.5.5+0" + +[[deps.OrderedCollections]] +git-tree-sha1 = "d321bf2de576bf25ec4d3e4360faca399afca282" +uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +version = "1.6.0" + +[[deps.Parsers]] +deps = ["Dates", "PrecompileTools", "UUIDs"] +git-tree-sha1 = "4b2e829ee66d4218e0cef22c0a64ee37cf258c29" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "2.7.1" + +[[deps.Pkg]] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.9.0" + +[[deps.PooledArrays]] +deps = ["DataAPI", "Future"] +git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7" +uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" +version = "1.4.2" + +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "9673d39decc5feece56ef3940e5dafba15ba0f81" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.1.2" + +[[deps.Preferences]] +deps = ["TOML"] +git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.4.0" + +[[deps.PrettyTables]] +deps = ["Crayons", "Formatting", "LaTeXStrings", "Markdown", "Reexport", "StringManipulation", "Tables"] +git-tree-sha1 = "542b1bd03329c1d235110f96f1bb0eeffc48a87d" +uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" +version = "2.2.6" + +[[deps.Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" + +[[deps.REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[[deps.Random]] +deps = ["SHA", "Serialization"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[[deps.RecipesBase]] +deps = ["PrecompileTools"] +git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff" +uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" +version = "1.3.4" + +[[deps.Reexport]] +git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" +uuid = "189a3867-3050-52da-a836-e630ba90ab69" +version = "1.2.2" + +[[deps.Requires]] +deps = ["UUIDs"] +git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" +uuid = "ae029012-a4dd-5104-9daa-d747884805df" +version = "1.3.0" + +[[deps.SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" + +[[deps.SQLStrings]] +git-tree-sha1 = "55de0530689832b1d3d43491ee6b67bd54d3323c" +uuid = "af517c2e-c243-48fa-aab8-efac3db270f5" +version = "0.1.0" + +[[deps.SQLite]] +deps = ["DBInterface", "Random", "SQLite_jll", "Serialization", "Tables", "WeakRefStrings"] +git-tree-sha1 = "eb9a473c9b191ced349d04efa612ec9f39c087ea" +uuid = "0aa819cd-b072-5ff4-a722-6bc24af294d9" +version = "1.6.0" + +[[deps.SQLite_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "4619dd3363610d94fb42a95a6dc35b526a26d0ef" +uuid = "76ed43ae-9a5d-5a62-8c75-30186b810ce8" +version = "3.42.0+0" + +[[deps.Scratch]] +deps = ["Dates"] +git-tree-sha1 = "30449ee12237627992a99d5e30ae63e4d78cd24a" +uuid = "6c6a2e73-6563-6170-7368-637461726353" +version = "1.2.0" + +[[deps.SentinelArrays]] +deps = ["Dates", "Random"] +git-tree-sha1 = "04bdff0b09c65ff3e06a05e3eb7b120223da3d39" +uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" +version = "1.4.0" + +[[deps.Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" + +[[deps.Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" + +[[deps.SortingAlgorithms]] +deps = ["DataStructures"] +git-tree-sha1 = "c60ec5c62180f27efea3ba2908480f8055e17cee" +uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" +version = "1.1.1" + +[[deps.SparseArrays]] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] +uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + +[[deps.SpecialFunctions]] +deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] +git-tree-sha1 = "7beb031cf8145577fbccacd94b8a8f4ce78428d3" +uuid = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "2.3.0" + + [deps.SpecialFunctions.extensions] + SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" + + [deps.SpecialFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + +[[deps.Statistics]] +deps = ["LinearAlgebra", "SparseArrays"] +uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.9.0" + +[[deps.StringManipulation]] +git-tree-sha1 = "46da2434b41f41ac3594ee9816ce5541c6096123" +uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e" +version = "0.3.0" + +[[deps.SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "5.10.1+6" + +[[deps.TOML]] +deps = ["Dates"] +uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.3" + +[[deps.TableTraits]] +deps = ["IteratorInterfaceExtensions"] +git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" +uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" +version = "1.0.1" + +[[deps.Tables]] +deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] +git-tree-sha1 = "1544b926975372da01227b382066ab70e574a3ec" +uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" +version = "1.10.1" + +[[deps.Tar]] +deps = ["ArgTools", "SHA"] +uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.0" + +[[deps.Test]] +deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[[deps.TimeZones]] +deps = ["Dates", "Downloads", "InlineStrings", "LazyArtifacts", "Mocking", "Printf", "RecipesBase", "Scratch", "Unicode"] +git-tree-sha1 = "cdaa0c2a4449724aded839550eca7d7240bb6938" +uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" +version = "1.10.0" + +[[deps.UTCDateTimes]] +deps = ["Dates", "TimeZones"] +git-tree-sha1 = "4af3552bf0cf4a071bf3d14bd20023ea70f31b62" +uuid = "0f7cfa37-7abf-4834-b969-a8aa512401c2" +version = "1.6.1" + +[[deps.UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" + +[[deps.Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" + +[[deps.WeakRefStrings]] +deps = ["DataAPI", "InlineStrings", "Parsers"] +git-tree-sha1 = "b1be2855ed9ed8eac54e5caff2afcdb442d52c23" +uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" +version = "1.4.2" + +[[deps.Zlib_jll]] +deps = ["Libdl"] +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.13+0" + +[[deps.libblastrampoline_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" +version = "5.8.0+0" + +[[deps.nghttp2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.48.0+0" + +[[deps.p7zip_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+0" diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..a563133 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,6 @@ +[deps] +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" +MySQL = "39abe10b-433b-5dbd-92d4-e302a9df00cd" +SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From 7d2b331009aaa97bc4a9772e67b4d00d0df5470a Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:18:38 -0400 Subject: [PATCH 33/58] Removed invalidations workflow temporarily --- .github/workflows/invalidations.yml | 40 ----------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/invalidations.yml diff --git a/.github/workflows/invalidations.yml b/.github/workflows/invalidations.yml deleted file mode 100644 index af4c158..0000000 --- a/.github/workflows/invalidations.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Invalidations - -on: - pull_request: - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: always. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - evaluate: - # Only run on PRs to the default branch. - # In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch - if: github.base_ref == github.event.repository.default_branch - runs-on: ubuntu-latest - steps: - - uses: julia-actions/setup-julia@v1 - with: - version: '1' - - uses: actions/checkout@v3 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-invalidations@v1 - id: invs_pr - - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.repository.default_branch }} - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-invalidations@v1 - id: invs_default - - - name: Report invalidation counts - run: | - echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY - echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY - - name: Check if the PR does increase number of invalidations - if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total - run: exit 1 \ No newline at end of file From a8054b213590f4f47c819359b74807be37235bcc Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:21:34 -0400 Subject: [PATCH 34/58] Exploring why pull request is not triggering actions --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14f3704..6f08b3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: branches: [main] tags: ["*"] pull_request: + concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: true From 3913deab7c7985021219266e86808ea64e878393 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:27:39 -0400 Subject: [PATCH 35/58] Added proper variable naming --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f08b3d..3c911dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,14 +48,14 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 env: - POSTGRES_USER = {{secrets.POSTGRES_USER}} - POSTGRES_HOST = {{secrets.POSTGRES_HOST}} - POSTGRES_PORT = {{secrets.POSTGRES_PORT}} - POSTGRES_PASSWORD = {{secrets.POSTGRES_PASSWORD}} - MYSQL_USER = {{secrets.MYSQL_USER}} - MYSQL_HOST = {{secrets.MYSQL_HOST}} - MYSQL_PORT = {{secrets.MYSQL_PORT}} - MYSQL_PASSWORD = {{secrets.MYSQL_PASSWORD}} + POSTGRES_USER: ${{ secrets.POSTGRES_USER }} + POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} + POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + MYSQL_USER: ${{ secrets.MYSQL_USER }} + MYSQL_HOST: ${{ secrets.MYSQL_HOST }} + MYSQL_PORT: ${{ secrets.MYSQL_PORT }} + MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: From a5315fd8fed92652ef1d632e2463d65b8b3a1cb2 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:34:32 -0400 Subject: [PATCH 36/58] Removed API reference --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index cae5db2..3089643 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using Test, DataFrames, SQLite -using MySQL,SQLite, MySQL.API, LibPQ +using MySQL, SQLite, LibPQ using DBConnector @testset "_dbconnect function for SQLite" begin From 75389c85c2f457fa9fd575818be9e7410a6af5f9 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:43:42 -0400 Subject: [PATCH 37/58] Testing for API error --- test/runtests.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 3089643..f4c8d31 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,9 @@ -using Test, DataFrames, SQLite -using MySQL, SQLite, LibPQ +using Test +using DataFrames +using SQLite +using MySQL +using SQLite +using LibPQ using DBConnector @testset "_dbconnect function for SQLite" begin From 584f321e72891693e50168c6ed417df045124275 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 15:57:34 -0400 Subject: [PATCH 38/58] Trying to fix up API error --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index f4c8d31..b142b94 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,7 @@ using MySQL using SQLite using LibPQ using DBConnector +import MySQL: API @testset "_dbconnect function for SQLite" begin From fb64e2867031672a64e073fbd8c1dcc7cbbcdb56 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 16:01:53 -0400 Subject: [PATCH 39/58] Added necessary import for the API --- src/DBConnector.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DBConnector.jl b/src/DBConnector.jl index 852175f..48efeb2 100644 --- a/src/DBConnector.jl +++ b/src/DBConnector.jl @@ -4,6 +4,7 @@ using DBInterface using LibPQ using SQLite using MySQL +import MySQL: API include("postgresql.jl") include("sqlite.jl") From 2fe8cc130361e886c7daa48e45c75be50951f1ad Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 16:02:19 -0400 Subject: [PATCH 40/58] Removed import as not needed --- test/runtests.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index b142b94..f4c8d31 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,7 +5,6 @@ using MySQL using SQLite using LibPQ using DBConnector -import MySQL: API @testset "_dbconnect function for SQLite" begin From 7f4a4b6e81d3108082255fc3e301b2d71ca954d1 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 16:11:43 -0400 Subject: [PATCH 41/58] Included LibPQ fork until PR is added from LibPQ --- test/Manifest.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Manifest.toml b/test/Manifest.toml index daa7489..680cd08 100644 --- a/test/Manifest.toml +++ b/test/Manifest.toml @@ -215,8 +215,10 @@ deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[deps.LibPQ]] -deps = ["CEnum", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "Infinity", "Intervals", "IterTools", "LayerDicts", "LibPQ_jll", "Libdl", "Memento", "OffsetArrays", "SQLStrings", "Tables", "TimeZones", "UTCDateTimes"] -git-tree-sha1 = "114d9d239ab8e1251354ad6bb97ed38622133114" +deps = ["CEnum", "DBInterface", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "Infinity", "Intervals", "IterTools", "LayerDicts", "LibPQ_jll", "Libdl", "Memento", "OffsetArrays", "SQLStrings", "Tables", "TimeZones", "UTCDateTimes"] +git-tree-sha1 = "b23b47236c2c5e1766a68ff19b74501c99340236" +repo-rev = "dbinterface" +repo-url = "https://github.com/chris-b1/LibPQ.jl" uuid = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" version = "1.15.1" From d0cb58fd5f93675d049e168acdf174926a4c7b57 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 17:28:50 -0400 Subject: [PATCH 42/58] Added authors --- Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.toml b/Project.toml index 8c260f7..d2be5b5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,5 +1,6 @@ name = "DBConnector" uuid = "5242bac9-aa14-4800-b46b-fcd14df13057" +authors = ["Jacob Zelko ", "Fareeda Abdelazeez"] version = "0.1.0" [deps] From 2ba693d96ad9ecab6a00f28e3d554e76a3f3b7ce Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 17:29:25 -0400 Subject: [PATCH 43/58] Redid postgresql interface --- src/postgresql.jl | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/postgresql.jl b/src/postgresql.jl index 32563d0..b35b18c 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -4,8 +4,7 @@ Dispatch for LibPQ interface to DBInterface `connect` function; not supported in DBInterface.connect(::Type{LibPQ.Connection}, args...; kws...) = LibPQ.Connection(args...; kws...) -function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String; db::String="", port::Integer=5432, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) - +function _dbconnect(conn_obj::Type{LibPQ.Connection}; kwargs...) conn_string = "" for k in kwargs conn_string = conn_string * "$(string(k.first))=$(k.second) " @@ -17,6 +16,36 @@ function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String end +#= + +function _dbconnect(conn_obj::Type{LibPQ.Connection}; host::String, user::String, password::String; db::String="", port::Integer=5432, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) + + """ + BUG DESCRIPTION: + + As of now, this function does not work. the conn_string is not built correctly and you'd probably need to build it manually with string interpolations. + + What this function would do is construct a connection string that looks like: + + "host = /var/run/postgresql user = user password = password dbname = mimiciii" + + However, the problem with the postgresql connection string is that the keywords in the string are actually positionally dependent. You can't just put them in any order. + """ + + + conn_string = "" + for k in kws + conn_string = conn_string * "$(string(k.first))=$(k.second) " + end + + conn_string = strip(conn_string) + + return DBInterface.connect(conn_obj, conn_string) + +end + +=# + """ Workaround for LibPQ interface to DBInterface's `prepare` function; not supported in LibPQ.jl package currently """ From a3b06ba60587fee788dff19c9e59873ce8695792 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 17:29:52 -0400 Subject: [PATCH 44/58] Finalized tests at the moment --- test/runtests.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index f4c8d31..3cd759f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,6 +17,7 @@ using DBConnector end + @testset "_dbconnect function for MySQL" begin conn = DBConnector._dbconnect(MySQL.Connection, ENV["MYSQL_HOST"], ENV["MYSQL_USER"], ENV["MYSQL_PASSWORD"], db="MySQL") @@ -29,7 +30,7 @@ end @testset "_dbconnect function for LibPQ" begin - conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"], ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], db = "mimic") + conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"], user = ENV["POSTGRES_USER"], dbname = "mimic", password = ENV["POSTGRES_PASSWORD"]) @test @isdefined conn end From 37250d006f9f3999cb5ab564fc4277797dc4fe16 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 17:31:18 -0400 Subject: [PATCH 45/58] Add manifest for test environment --- test/Manifest.toml | 557 --------------------------------------------- 1 file changed, 557 deletions(-) delete mode 100644 test/Manifest.toml diff --git a/test/Manifest.toml b/test/Manifest.toml deleted file mode 100644 index 680cd08..0000000 --- a/test/Manifest.toml +++ /dev/null @@ -1,557 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -julia_version = "1.9.1" -manifest_format = "2.0" -project_hash = "209e080a85c8d66260678d06ee150de40b189cf0" - -[[deps.Adapt]] -deps = ["LinearAlgebra", "Requires"] -git-tree-sha1 = "76289dc51920fdc6e0013c872ba9551d54961c24" -uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "3.6.2" - - [deps.Adapt.extensions] - AdaptStaticArraysExt = "StaticArrays" - - [deps.Adapt.weakdeps] - StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" - -[[deps.ArgTools]] -uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" - -[[deps.Artifacts]] -uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" - -[[deps.Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[deps.CEnum]] -git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90" -uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" -version = "0.4.2" - -[[deps.Compat]] -deps = ["UUIDs"] -git-tree-sha1 = "4e88377ae7ebeaf29a047aa1ee40826e0b708a5d" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.7.0" -weakdeps = ["Dates", "LinearAlgebra"] - - [deps.Compat.extensions] - CompatLinearAlgebraExt = "LinearAlgebra" - -[[deps.CompilerSupportLibraries_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.2+0" - -[[deps.Crayons]] -git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" -uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" -version = "4.1.1" - -[[deps.DBInterface]] -git-tree-sha1 = "9b0dc525a052b9269ccc5f7f04d5b3639c65bca5" -uuid = "a10d1c49-ce27-4219-8d33-6db1a4562965" -version = "2.5.0" - -[[deps.DataAPI]] -git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c" -uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.15.0" - -[[deps.DataFrames]] -deps = ["Compat", "DataAPI", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "089d29c0fc00a190661517e4f3cba5dcb3fd0c08" -uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "1.6.0" - -[[deps.DataStructures]] -deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "cf25ccb972fec4e4817764d01c82386ae94f77b4" -uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.14" - -[[deps.DataValueInterfaces]] -git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" -uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" -version = "1.0.0" - -[[deps.Dates]] -deps = ["Printf"] -uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[deps.DecFP]] -deps = ["DecFP_jll", "Printf", "Random", "SpecialFunctions"] -git-tree-sha1 = "4a10cec664e26d9d63597daf9e62147e79d636e3" -uuid = "55939f99-70c6-5e9b-8bb0-5071ed7d61fd" -version = "1.3.2" - -[[deps.DecFP_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "e9a8da19f847bbfed4076071f6fef8665a30d9e5" -uuid = "47200ebd-12ce-5be5-abb7-8e082af23329" -version = "2.0.3+1" - -[[deps.Decimals]] -git-tree-sha1 = "e98abef36d02a0ec385d68cd7dadbce9b28cbd88" -uuid = "abce61dc-4473-55a0-ba07-351d65e31d42" -version = "0.4.1" - -[[deps.Distributed]] -deps = ["Random", "Serialization", "Sockets"] -uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" - -[[deps.DocStringExtensions]] -deps = ["LibGit2"] -git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" -uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.9.3" - -[[deps.Downloads]] -deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] -uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" -version = "1.6.0" - -[[deps.ExprTools]] -git-tree-sha1 = "c1d06d129da9f55715c6c212866f5b1bddc5fa00" -uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" -version = "0.1.9" - -[[deps.FileWatching]] -uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" - -[[deps.Formatting]] -deps = ["Printf"] -git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8" -uuid = "59287772-0a20-5a39-b81b-1366585eb4c0" -version = "0.4.2" - -[[deps.Future]] -deps = ["Random"] -uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" - -[[deps.Infinity]] -deps = ["Dates", "Random", "Requires"] -git-tree-sha1 = "cf8234411cbeb98676c173f930951ea29dca3b23" -uuid = "a303e19e-6eb4-11e9-3b09-cd9505f79100" -version = "0.2.4" - -[[deps.InlineStrings]] -deps = ["Parsers"] -git-tree-sha1 = "9cc2baf75c6d09f9da536ddf58eb2f29dedaf461" -uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" -version = "1.4.0" - -[[deps.InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[deps.Intervals]] -deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"] -git-tree-sha1 = "ac0aaa807ed5eaf13f67afe188ebc07e828ff640" -uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5" -version = "1.10.0" - -[[deps.InvertedIndices]] -git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038" -uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" -version = "1.3.0" - -[[deps.IrrationalConstants]] -git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" -uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" -version = "0.2.2" - -[[deps.IterTools]] -git-tree-sha1 = "4ced6667f9974fc5c5943fa5e2ef1ca43ea9e450" -uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" -version = "1.8.0" - -[[deps.IteratorInterfaceExtensions]] -git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" -uuid = "82899510-4779-5014-852e-03e436cf321d" -version = "1.0.0" - -[[deps.JLLWrappers]] -deps = ["Preferences"] -git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" -uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.4.1" - -[[deps.Kerberos_krb5_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "60274b4ab38e8d1248216fe6b6ace75ae09b0502" -uuid = "b39eb1a6-c29a-53d7-8c32-632cd16f18da" -version = "1.19.3+0" - -[[deps.LaTeXStrings]] -git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996" -uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" -version = "1.3.0" - -[[deps.LayerDicts]] -git-tree-sha1 = "6087ad3521d6278ebe5c27ae55e7bbb15ca312cb" -uuid = "6f188dcb-512c-564b-bc01-e0f76e72f166" -version = "1.0.0" - -[[deps.LazyArtifacts]] -deps = ["Artifacts", "Pkg"] -uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" - -[[deps.LibCURL]] -deps = ["LibCURL_jll", "MozillaCACerts_jll"] -uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.3" - -[[deps.LibCURL_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] -uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "7.84.0+0" - -[[deps.LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] -uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" - -[[deps.LibPQ]] -deps = ["CEnum", "DBInterface", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "Infinity", "Intervals", "IterTools", "LayerDicts", "LibPQ_jll", "Libdl", "Memento", "OffsetArrays", "SQLStrings", "Tables", "TimeZones", "UTCDateTimes"] -git-tree-sha1 = "b23b47236c2c5e1766a68ff19b74501c99340236" -repo-rev = "dbinterface" -repo-url = "https://github.com/chris-b1/LibPQ.jl" -uuid = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" -version = "1.15.1" - -[[deps.LibPQ_jll]] -deps = ["Artifacts", "JLLWrappers", "Kerberos_krb5_jll", "Libdl", "OpenSSL_jll", "Pkg"] -git-tree-sha1 = "a299629703a93d8efcefccfc16b18ad9a073d131" -uuid = "08be9ffa-1c94-5ee5-a977-46a84ec9b350" -version = "14.3.0+1" - -[[deps.LibSSH2_jll]] -deps = ["Artifacts", "Libdl", "MbedTLS_jll"] -uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.10.2+0" - -[[deps.Libdl]] -uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -[[deps.Libiconv_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "c7cb1f5d892775ba13767a87c7ada0b980ea0a71" -uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" -version = "1.16.1+2" - -[[deps.LinearAlgebra]] -deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] -uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - -[[deps.LogExpFunctions]] -deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "c3ce8e7420b3a6e071e0fe4745f5d4300e37b13f" -uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.24" - - [deps.LogExpFunctions.extensions] - LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" - LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables" - LogExpFunctionsInverseFunctionsExt = "InverseFunctions" - - [deps.LogExpFunctions.weakdeps] - ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" - ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" - InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" - -[[deps.Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[deps.MariaDB_Connector_C_jll]] -deps = ["Artifacts", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "Pkg", "Zlib_jll"] -git-tree-sha1 = "30523a011413b08ee38a6ed6a18e84c363d0ce79" -uuid = "aabc7e14-95f1-5e66-9f32-aea603782360" -version = "3.1.12+0" - -[[deps.Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[deps.MbedTLS_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+0" - -[[deps.Memento]] -deps = ["Dates", "Distributed", "Requires", "Serialization", "Sockets", "Test", "UUIDs"] -git-tree-sha1 = "bb2e8f4d9f400f6e90d57b34860f6abdc51398e5" -uuid = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9" -version = "1.4.1" - -[[deps.Missings]] -deps = ["DataAPI"] -git-tree-sha1 = "f66bdc5de519e8f8ae43bdc598782d35a25b1272" -uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" -version = "1.1.0" - -[[deps.Mocking]] -deps = ["Compat", "ExprTools"] -git-tree-sha1 = "4cc0c5a83933648b615c36c2b956d94fda70641e" -uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" -version = "0.7.7" - -[[deps.MozillaCACerts_jll]] -uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2022.10.11" - -[[deps.MySQL]] -deps = ["DBInterface", "Dates", "DecFP", "Libdl", "MariaDB_Connector_C_jll", "Parsers", "Tables"] -git-tree-sha1 = "2f962011721ba26f3b3467b05610a08cfd2caff5" -uuid = "39abe10b-433b-5dbd-92d4-e302a9df00cd" -version = "1.4.3" - -[[deps.NetworkOptions]] -uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" -version = "1.2.0" - -[[deps.OffsetArrays]] -deps = ["Adapt"] -git-tree-sha1 = "2ac17d29c523ce1cd38e27785a7d23024853a4bb" -uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.12.10" - -[[deps.OpenBLAS_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] -uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.21+4" - -[[deps.OpenLibm_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "05823500-19ac-5b8b-9628-191a04bc5112" -version = "0.8.1+0" - -[[deps.OpenSSL_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "1aa4b74f80b01c6bc2b89992b861b5f210e665b5" -uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "1.1.21+0" - -[[deps.OpenSpecFun_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" -uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" -version = "0.5.5+0" - -[[deps.OrderedCollections]] -git-tree-sha1 = "d321bf2de576bf25ec4d3e4360faca399afca282" -uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.6.0" - -[[deps.Parsers]] -deps = ["Dates", "PrecompileTools", "UUIDs"] -git-tree-sha1 = "4b2e829ee66d4218e0cef22c0a64ee37cf258c29" -uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.7.1" - -[[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] -uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.9.0" - -[[deps.PooledArrays]] -deps = ["DataAPI", "Future"] -git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7" -uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" -version = "1.4.2" - -[[deps.PrecompileTools]] -deps = ["Preferences"] -git-tree-sha1 = "9673d39decc5feece56ef3940e5dafba15ba0f81" -uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -version = "1.1.2" - -[[deps.Preferences]] -deps = ["TOML"] -git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1" -uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.4.0" - -[[deps.PrettyTables]] -deps = ["Crayons", "Formatting", "LaTeXStrings", "Markdown", "Reexport", "StringManipulation", "Tables"] -git-tree-sha1 = "542b1bd03329c1d235110f96f1bb0eeffc48a87d" -uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" -version = "2.2.6" - -[[deps.Printf]] -deps = ["Unicode"] -uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - -[[deps.Random]] -deps = ["SHA", "Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[deps.RecipesBase]] -deps = ["PrecompileTools"] -git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff" -uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" -version = "1.3.4" - -[[deps.Reexport]] -git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" -uuid = "189a3867-3050-52da-a836-e630ba90ab69" -version = "1.2.2" - -[[deps.Requires]] -deps = ["UUIDs"] -git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" -uuid = "ae029012-a4dd-5104-9daa-d747884805df" -version = "1.3.0" - -[[deps.SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" -version = "0.7.0" - -[[deps.SQLStrings]] -git-tree-sha1 = "55de0530689832b1d3d43491ee6b67bd54d3323c" -uuid = "af517c2e-c243-48fa-aab8-efac3db270f5" -version = "0.1.0" - -[[deps.SQLite]] -deps = ["DBInterface", "Random", "SQLite_jll", "Serialization", "Tables", "WeakRefStrings"] -git-tree-sha1 = "eb9a473c9b191ced349d04efa612ec9f39c087ea" -uuid = "0aa819cd-b072-5ff4-a722-6bc24af294d9" -version = "1.6.0" - -[[deps.SQLite_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"] -git-tree-sha1 = "4619dd3363610d94fb42a95a6dc35b526a26d0ef" -uuid = "76ed43ae-9a5d-5a62-8c75-30186b810ce8" -version = "3.42.0+0" - -[[deps.Scratch]] -deps = ["Dates"] -git-tree-sha1 = "30449ee12237627992a99d5e30ae63e4d78cd24a" -uuid = "6c6a2e73-6563-6170-7368-637461726353" -version = "1.2.0" - -[[deps.SentinelArrays]] -deps = ["Dates", "Random"] -git-tree-sha1 = "04bdff0b09c65ff3e06a05e3eb7b120223da3d39" -uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" -version = "1.4.0" - -[[deps.Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[deps.Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[deps.SortingAlgorithms]] -deps = ["DataStructures"] -git-tree-sha1 = "c60ec5c62180f27efea3ba2908480f8055e17cee" -uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" -version = "1.1.1" - -[[deps.SparseArrays]] -deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" - -[[deps.SpecialFunctions]] -deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] -git-tree-sha1 = "7beb031cf8145577fbccacd94b8a8f4ce78428d3" -uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "2.3.0" - - [deps.SpecialFunctions.extensions] - SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" - - [deps.SpecialFunctions.weakdeps] - ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" - -[[deps.Statistics]] -deps = ["LinearAlgebra", "SparseArrays"] -uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.9.0" - -[[deps.StringManipulation]] -git-tree-sha1 = "46da2434b41f41ac3594ee9816ce5541c6096123" -uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e" -version = "0.3.0" - -[[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] -uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "5.10.1+6" - -[[deps.TOML]] -deps = ["Dates"] -uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" -version = "1.0.3" - -[[deps.TableTraits]] -deps = ["IteratorInterfaceExtensions"] -git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" -uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" -version = "1.0.1" - -[[deps.Tables]] -deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] -git-tree-sha1 = "1544b926975372da01227b382066ab70e574a3ec" -uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.10.1" - -[[deps.Tar]] -deps = ["ArgTools", "SHA"] -uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" -version = "1.10.0" - -[[deps.Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[deps.TimeZones]] -deps = ["Dates", "Downloads", "InlineStrings", "LazyArtifacts", "Mocking", "Printf", "RecipesBase", "Scratch", "Unicode"] -git-tree-sha1 = "cdaa0c2a4449724aded839550eca7d7240bb6938" -uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" -version = "1.10.0" - -[[deps.UTCDateTimes]] -deps = ["Dates", "TimeZones"] -git-tree-sha1 = "4af3552bf0cf4a071bf3d14bd20023ea70f31b62" -uuid = "0f7cfa37-7abf-4834-b969-a8aa512401c2" -version = "1.6.1" - -[[deps.UUIDs]] -deps = ["Random", "SHA"] -uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" - -[[deps.Unicode]] -uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" - -[[deps.WeakRefStrings]] -deps = ["DataAPI", "InlineStrings", "Parsers"] -git-tree-sha1 = "b1be2855ed9ed8eac54e5caff2afcdb442d52c23" -uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" -version = "1.4.2" - -[[deps.Zlib_jll]] -deps = ["Libdl"] -uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+0" - -[[deps.libblastrampoline_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+0" - -[[deps.nghttp2_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.48.0+0" - -[[deps.p7zip_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+0" From 53e10065b7a6b690e8ede65c674ed28add428434 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 17:34:57 -0400 Subject: [PATCH 46/58] Just testing without MySQL server support --- test/runtests.jl | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 3cd759f..456778c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,16 +18,6 @@ using DBConnector end -@testset "_dbconnect function for MySQL" begin - - conn = DBConnector._dbconnect(MySQL.Connection, ENV["MYSQL_HOST"], ENV["MYSQL_USER"], ENV["MYSQL_PASSWORD"], db="MySQL") - - @test typeof(conn) == MySQL.Connection - @test isopen(conn) - close(conn) - -end - @testset "_dbconnect function for LibPQ" begin conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"], user = ENV["POSTGRES_USER"], dbname = "mimic", password = ENV["POSTGRES_PASSWORD"]) From f69c868910e99819cc68eee0c375f9bf440acaa4 Mon Sep 17 00:00:00 2001 From: TheCedarPrince Date: Fri, 21 Jul 2023 17:40:02 -0400 Subject: [PATCH 47/58] Added back in MySQL tests --- test/runtests.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 456778c..3cd759f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,6 +18,16 @@ using DBConnector end +@testset "_dbconnect function for MySQL" begin + + conn = DBConnector._dbconnect(MySQL.Connection, ENV["MYSQL_HOST"], ENV["MYSQL_USER"], ENV["MYSQL_PASSWORD"], db="MySQL") + + @test typeof(conn) == MySQL.Connection + @test isopen(conn) + close(conn) + +end + @testset "_dbconnect function for LibPQ" begin conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"], user = ENV["POSTGRES_USER"], dbname = "mimic", password = ENV["POSTGRES_PASSWORD"]) From f71cc671efc55d2287ba9a5d7ab34be41f053740 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Wed, 9 Aug 2023 20:16:14 +0300 Subject: [PATCH 48/58] fixing tests --- src/postgresql.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/postgresql.jl b/src/postgresql.jl index b35b18c..1f6ff0b 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -16,6 +16,23 @@ function _dbconnect(conn_obj::Type{LibPQ.Connection}; kwargs...) end +function _dbconnect(conn_obj::Type{LibPQ.Connection}, conn_string :: String) + + return DBInterface.connect(conn_obj, conn_string) + +end + +function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String; db::String="", port::Integer=3306, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) + + if unix_socket == nothing + unix_socket = API.MYSQL_DEFAULT_SOCKET + end + + conn_string = "postgersql://$(user):$(password)@$(host)/$(db)?user=$(user)" + + return DBInterface.connect(conn_obj, conn_string) + +end #= function _dbconnect(conn_obj::Type{LibPQ.Connection}; host::String, user::String, password::String; db::String="", port::Integer=5432, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) From 4bc4225af170265eab18f1509d0e9ca7c7cf4354 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 10 Aug 2023 13:42:22 +0300 Subject: [PATCH 49/58] testing the LibPQ test --- test/runtests.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 3cd759f..29d6824 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,6 +17,12 @@ using DBConnector end +@testset "_dbconnect function for LibPQ" begin + + conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"], user = ENV["POSTGRES_USER"], dbname = "mimic", password = ENV["POSTGRES_PASSWORD"]) + @test @isdefined conn + +end @testset "_dbconnect function for MySQL" begin @@ -28,9 +34,4 @@ end end -@testset "_dbconnect function for LibPQ" begin - conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"], user = ENV["POSTGRES_USER"], dbname = "mimic", password = ENV["POSTGRES_PASSWORD"]) - @test @isdefined conn - -end From a80130839f791fb81b122e362c6a00a96f0e74ce Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 10 Aug 2023 13:50:18 +0300 Subject: [PATCH 50/58] . --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 29d6824..cbac0f7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,7 +19,7 @@ end @testset "_dbconnect function for LibPQ" begin - conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"], user = ENV["POSTGRES_USER"], dbname = "mimic", password = ENV["POSTGRES_PASSWORD"]) + conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], password = ENV["POSTGRES_PASSWORD"], db = "mimic") @test @isdefined conn end From 4b86aba03e59c7178c822fa2e4741683774b6736 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 10 Aug 2023 21:00:35 +0300 Subject: [PATCH 51/58] . --- src/postgresql.jl | 2 +- test/runtests.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/postgresql.jl b/src/postgresql.jl index 1f6ff0b..7e0a02c 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -22,7 +22,7 @@ function _dbconnect(conn_obj::Type{LibPQ.Connection}, conn_string :: String) end -function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String; db::String="", port::Integer=3306, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) +function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String, db::String; port::Integer=3306, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) if unix_socket == nothing unix_socket = API.MYSQL_DEFAULT_SOCKET diff --git a/test/runtests.jl b/test/runtests.jl index cbac0f7..2d3ef32 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,7 +19,7 @@ end @testset "_dbconnect function for LibPQ" begin - conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], password = ENV["POSTGRES_PASSWORD"], db = "mimic") + conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "mimic") @test @isdefined conn end From 16bbbbde580bf2207ad020802db12e79ca92e2a9 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 10 Aug 2023 21:04:36 +0300 Subject: [PATCH 52/58] . --- src/postgresql.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postgresql.jl b/src/postgresql.jl index 7e0a02c..7a79797 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -28,7 +28,7 @@ function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String unix_socket = API.MYSQL_DEFAULT_SOCKET end - conn_string = "postgersql://$(user):$(password)@$(host)/$(db)?user=$(user)" + conn_string = "postgresql://$(user):$(password)@$(host)/$(db)?user=$(user)" return DBInterface.connect(conn_obj, conn_string) From d2571d25f23db68a1ba119df7ca1bd8e3b71ae13 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 10 Aug 2023 21:13:34 +0300 Subject: [PATCH 53/58] . --- src/postgresql.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postgresql.jl b/src/postgresql.jl index 7a79797..19b3b74 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -22,7 +22,7 @@ function _dbconnect(conn_obj::Type{LibPQ.Connection}, conn_string :: String) end -function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String, db::String; port::Integer=3306, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) +function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String, db::String; port::Integer=5432) if unix_socket == nothing unix_socket = API.MYSQL_DEFAULT_SOCKET From fd52e17dc01a41eb9f134dcce5cf0fb7e5f980d2 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Wed, 23 Aug 2023 20:02:05 +0300 Subject: [PATCH 54/58] fixing postgres function --- src/postgresql.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/postgresql.jl b/src/postgresql.jl index 19b3b74..a856133 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -24,10 +24,6 @@ end function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String, db::String; port::Integer=5432) - if unix_socket == nothing - unix_socket = API.MYSQL_DEFAULT_SOCKET - end - conn_string = "postgresql://$(user):$(password)@$(host)/$(db)?user=$(user)" return DBInterface.connect(conn_obj, conn_string) From 71efeceb5d837ed1588b57880041d2a7d4fddd30 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Wed, 23 Aug 2023 21:20:50 +0300 Subject: [PATCH 55/58] checking it is not env error --- test/runtests.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 2d3ef32..63d80a4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,7 +19,8 @@ end @testset "_dbconnect function for LibPQ" begin - conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "mimic") + #conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "omop") + DBConnector._dbconnect(LibPQ.Connection, "199.180.155.65", "postgres", "postgres3", "omop") @test @isdefined conn end From 41e8e0292d31007ab1e9bcfd6679b947a2a0faa9 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Wed, 23 Aug 2023 21:30:10 +0300 Subject: [PATCH 56/58] again --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 63d80a4..0dedefa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -20,7 +20,7 @@ end @testset "_dbconnect function for LibPQ" begin #conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "omop") - DBConnector._dbconnect(LibPQ.Connection, "199.180.155.65", "postgres", "postgres3", "omop") + conn = DBConnector._dbconnect(LibPQ.Connection, "199.180.155.65", "postgres", "postgres3", "omop") @test @isdefined conn end From 666bc103d9bbf97a72223e043f03cb355b6d5592 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 24 Aug 2023 12:37:03 +0300 Subject: [PATCH 57/58] sql same so the problem is with github secrets variables, let's test on mySQL --- Project.toml | 1 - docs/src/Tutorials/postgreSQL.md | 2 +- test/runtests.jl | 13 ++++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index d2be5b5..4f93717 100644 --- a/Project.toml +++ b/Project.toml @@ -12,7 +12,6 @@ SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" [compat] DBInterface = "2.5" LibPQ = "1.15" -MySQL = "1.4" SQLite = "1.6" julia = "1.6" diff --git a/docs/src/Tutorials/postgreSQL.md b/docs/src/Tutorials/postgreSQL.md index 09abc3d..0dfd19f 100644 --- a/docs/src/Tutorials/postgreSQL.md +++ b/docs/src/Tutorials/postgreSQL.md @@ -70,4 +70,4 @@ Note: It produces error only in case the path is incorrect credentials Package descriptions: -- [`LibPQ`](https://github.com/chris-b1/LibPQ.jl#dbinterface) - A Julia interface to the LibPQ library \ No newline at end of file +- [LibPQ](https://github.com/chris-b1/LibPQ.jl#dbinterface) - A Julia interface to the LibPQ library \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 0dedefa..afe68d0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,6 @@ using Test using DataFrames using SQLite using MySQL -using SQLite using LibPQ using DBConnector @@ -19,20 +18,20 @@ end @testset "_dbconnect function for LibPQ" begin - #conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "omop") - conn = DBConnector._dbconnect(LibPQ.Connection, "199.180.155.65", "postgres", "postgres3", "omop") + conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "omop") @test @isdefined conn end - +""" @testset "_dbconnect function for MySQL" begin - conn = DBConnector._dbconnect(MySQL.Connection, ENV["MYSQL_HOST"], ENV["MYSQL_USER"], ENV["MYSQL_PASSWORD"], db="MySQL") - + #conn = DBConnector._dbconnect(MySQL.Connection, ENV["MYSQL_HOST"], ENV["MYSQL_USER"], ENV["MYSQL_PASSWORD"], db="MySQL") + conn = DBConnector._dbconnect(MySQL.Connection, "199.180.155.65","fareeda", "GSoCPass"; db="MySQL") + @test @isdefined conn @test typeof(conn) == MySQL.Connection @test isopen(conn) close(conn) end - +""" From 503bbe9ef485c4a1ec457199c115dea0b8d25c42 Mon Sep 17 00:00:00 2001 From: Farreeda Date: Thu, 24 Aug 2023 21:31:11 +0300 Subject: [PATCH 58/58] kwargs for mysql and postgresql Almost the secrets issue is because the PR has no access to the environment secrets of the base repo --- docs/make.jl | 1 + docs/src/Tutorials/postgreSQL.md | 25 ++++-- src/mysql.jl | 87 +++++++++++++++++++- src/postgresql.jl | 134 ++++++++++++++++++++----------- test/runtests.jl | 3 +- 5 files changed, 190 insertions(+), 60 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index f8f8f8b..38198fe 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,3 +1,4 @@ +using DBConnector using Documenter makedocs(; diff --git a/docs/src/Tutorials/postgreSQL.md b/docs/src/Tutorials/postgreSQL.md index 0dfd19f..c427fae 100644 --- a/docs/src/Tutorials/postgreSQL.md +++ b/docs/src/Tutorials/postgreSQL.md @@ -14,15 +14,14 @@ Get your database's : 1- username 2- password - 3- host - 5- Database name + optional: + - host + - Database name - port (5432 by default) - - unix_socket - - client_flag - - opts=opts +Note: If you have additional keys that are necessary to be added, Jump to Method 2: ## Environment Set-Up @@ -50,7 +49,7 @@ TUTORIAL> add DBConnector ``` using DBConnector -conn= _dbconnect(LibPQ.Connection, host, user, password, db=db) +conn= _dbconnect(LibPQ.Connection; host = host, user = user, password = password, db=db) ``` In case you want to use the optional strings: @@ -58,14 +57,26 @@ In case you want to use the optional strings: ``` using DBConnector -conn= _dbconnect(LibPQ.Connection, host, user, password, db="the database name", port = 5432, unix_socket=unix_socket, client_flag=client_flag, opts=opts ) +conn= _dbconnect(LibPQ.Connection; host = host, user = user, password = password, db="the database name", port = 5432) ``` + + Now you are connected! Note: It produces error only in case the path is incorrect credentials +# Method 2 + +create your own connection string as this example: + +``` +connection_string = "postgresql://username:password@unix:/path/to/socket/directory/database_name" + +conn= _dbconnect(LibPQ.Connection, connection_string) +``` + ### Packages Used in Analysis Package descriptions: diff --git a/src/mysql.jl b/src/mysql.jl index 0075238..70a0e17 100644 --- a/src/mysql.jl +++ b/src/mysql.jl @@ -1,8 +1,87 @@ -function _dbconnect(conn_obj::Type{MySQL.Connection}, host::String, user::String, password::String; db::String="", port::Integer=3306, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) +function _dbconnect(conn_obj::Type{MySQL.Connection}; kwargs...) - if unix_socket == nothing - unix_socket = API.MYSQL_DEFAULT_SOCKET + + if haskey(kwargs, :host) && haskey(kwargs, :user) + host = kwargs[:host] + kwargs = filter(kvp -> first(kvp) != :host, kwargs) + user = kwargs[:user] + kwargs = filter(kvp -> first(kvp) != :user, kwargs) + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user) + elseif haskey(kwargs, :password) + password=kwargs[:password] + kwargs = filter(kvp -> first(kvp) != :password, kwargs) + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user, password) + elseif haskey(kwargs, :db) + db = kwargs[:db] + kwargs = filter(kvp -> first(kvp) != :db, kwargs) + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user, password; kwargs) + elseif haskey(kwargs, :port) + db = kwargs[:port] + kwargs = filter(kvp -> first(kvp) != :port, kwargs) + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user; kwargs) + end + end + end + elseif haskey(kwargs, :db) + db = kwargs[:db] + kwargs = filter(kvp -> first(kvp) != :db, kwargs) + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user; kwargs) + elseif haskey(kwargs, :port) + db = kwargs[:port] + kwargs = filter(kvp -> first(kvp) != :port, kwargs) + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user; kwargs) + end + end + end + + else + error("Invalid arguments, make sure that keyword user and host exists") + end +end + + # if !haskey(kwargs, "unix_socket") + # unix_socket = API.MYSQL_DEFAULT_SOCKET + # kwargs.push(unix_socket) + #end +""" + if haskey(kwargs, :host) + + host = kwargs[:host] + kwargs = filter(kvp -> first(kvp) != :host, kwargs) + if haskey(kwargs, :user) + user = kwargs[:user] + kwargs = filter(kvp -> first(kvp) != :user, kwargs) + elseif haskey(kwargs, :username) + user = kwargs[:username] + kwargs = filter(kvp -> first(kvp) != :username, kwargs) + else + error("Invalid arguments, make sure that keyword user exists") + end + else + error("Invalid arguments, make sure that keyword host exists") + end + if haskey(kwargs, :password) + password=kwargs[:password] + kwargs = filter(kvp -> first(kvp) != :password, kwargs) + elseif isempty(kwargs) + return DBInterface.connect(conn_obj,host, user) + else + return DBInterface.connect(conn_obj,host, user; kwargs) end + if isempty(kwargs) + return DBInterface.connect(conn_obj,host, user, password) + else + + return DBInterface.connect(conn_obj,host, user, password; kwargs) - return DBInterface.connect(conn_obj,host, user, password, db=db, port=port, unix_socket=unix_socket, client_flag=client_flag, opts=opts ) + end + return DBInterface.connect(conn_obj; kwargs...) + #return DBInterface.connect(conn_obj,host, user, password, db=db, port=port, unix_socket=unix_socket, client_flag=client_flag, opts=opts ) end +""" \ No newline at end of file diff --git a/src/postgresql.jl b/src/postgresql.jl index a856133..9be12e3 100644 --- a/src/postgresql.jl +++ b/src/postgresql.jl @@ -1,54 +1,107 @@ +""" +Workaround for LibPQ interface to DBInterface's `prepare` function; not supported in LibPQ.jl package currently +""" +DBInterface.prepare(conn::LibPQ.Connection, args...; kws...) = + LibPQ.prepare(conn, args...; kws...) + + """ Dispatch for LibPQ interface to DBInterface `connect` function; not supported in LibPQ.jl package currently """ DBInterface.connect(::Type{LibPQ.Connection}, args...; kws...) = LibPQ.Connection(args...; kws...) + """ + This LibPQ connection function creates a connection string using + 1- username (user) + 2- hostname (host) + 3- password + 4- database (db) + 5- port + + Cases handles: + 1- user and host + 2- user, host, db + 3- user, host, password + 4- user, host, password, db + 5- user, host, password, db, port + 6- user, host, db, port + + adding other keywords can't be handled yet + """ + function _dbconnect(conn_obj::Type{LibPQ.Connection}; kwargs...) - conn_string = "" - for k in kwargs - conn_string = conn_string * "$(string(k.first))=$(k.second) " - end - conn_string = strip(conn_string) - - return DBInterface.connect(conn_obj, conn_string) + if haskey(kwargs, :host) && haskey(kwargs, :user) + host = kwargs[:host] + kwargs = filter(kvp -> first(kvp) != :host, kwargs) + user = kwargs[:user] + kwargs = filter(kvp -> first(kvp) != :user, kwargs) + if isempty(kwargs) + conn_string = "postgresql://$user@$host" + return DBInterface.connect(conn_obj, conn_string) + elseif haskey(kwargs, :password) + password=kwargs[:password] + kwargs = filter(kvp -> first(kvp) != :password, kwargs) + if isempty(kwargs) + conn_string = "postgresql://$user:$password@$host" + return DBInterface.connect(conn_obj, conn_string) + elseif haskey(kwargs, :db) + db = kwargs[:db] + kwargs = filter(kvp -> first(kvp) != :db, kwargs) + if isempty(kwargs) + conn_string = "postgresql://$(user):$(password)@$(host)/$(db)?user=$(user)" + return DBInterface.connect(conn_obj, conn_string) + elseif haskey(kwargs, :port) + db = kwargs[:port] + kwargs = filter(kvp -> first(kvp) != :port, kwargs) + if isempty(kwargs) + conn_string = "postgresql://$user:$password@$host:$port/$db" + return DBInterface.connect(conn_obj, conn_string) + end + end + end + elseif haskey(kwargs, :db) + db = kwargs[:db] + kwargs = filter(kvp -> first(kvp) != :db, kwargs) + if isempty(kwargs) + conn_string = "postgresql://$user@$host/$db" + return DBInterface.connect(conn_obj, conn_string) + elseif haskey(kwargs, :port) + db = kwargs[:port] + kwargs = filter(kvp -> first(kvp) != :port, kwargs) + if isempty(kwargs) + conn_string = "postgresql://$user@$host:$port/$db" + return DBInterface.connect(conn_obj, conn_string) + end + end + + else + error("Invalid arguments, make sure that keyword user and host exist") + end +end end -function _dbconnect(conn_obj::Type{LibPQ.Connection}, conn_string :: String) - - return DBInterface.connect(conn_obj, conn_string) -end +""" +Workaround for LibPQ interface to DBInterface's `execute` function; not supported in LibPQ.jl package currently +""" +DBInterface.execute(conn::Union{LibPQ.Connection, LibPQ.Statement}, args...; kws...) = + LibPQ.execute(conn, args...; kws...) -function _dbconnect(conn_obj::Type{LibPQ.Connection}, host::String, user::String, password::String, db::String; port::Integer=5432) - conn_string = "postgresql://$(user):$(password)@$(host)/$(db)?user=$(user)" +function _dbconnect(conn_obj::Type{LibPQ.Connection}, conn_string :: String) + return DBInterface.connect(conn_obj, conn_string) end -#= - -function _dbconnect(conn_obj::Type{LibPQ.Connection}; host::String, user::String, password::String; db::String="", port::Integer=5432, unix_socket::Union{Nothing,String}=nothing, client_flag=API.CLIENT_MULTI_STATEMENTS, opts = Dict()) - - """ - BUG DESCRIPTION: - - As of now, this function does not work. the conn_string is not built correctly and you'd probably need to build it manually with string interpolations. - - What this function would do is construct a connection string that looks like: - - "host = /var/run/postgresql user = user password = password dbname = mimiciii" - - However, the problem with the postgresql connection string is that the keywords in the string are actually positionally dependent. You can't just put them in any order. - """ - - +""" +function _dbconnect(conn_obj::Type{LibPQ.Connection}; kwargs...) conn_string = "" - for k in kws - conn_string = conn_string * "$(string(k.first))=$(k.second) " + for k in kwargs + conn_string = conn_string * "(string(k.first))=(k.second) " end conn_string = strip(conn_string) @@ -56,19 +109,4 @@ function _dbconnect(conn_obj::Type{LibPQ.Connection}; host::String, user::String return DBInterface.connect(conn_obj, conn_string) end - -=# - -""" -Workaround for LibPQ interface to DBInterface's `prepare` function; not supported in LibPQ.jl package currently -""" -DBInterface.prepare(conn::LibPQ.Connection, args...; kws...) = - LibPQ.prepare(conn, args...; kws...) - -""" -Workaround for LibPQ interface to DBInterface's `execute` function; not supported in LibPQ.jl package currently -""" -DBInterface.execute(conn::Union{LibPQ.Connection, LibPQ.Statement}, args...; kws...) = - LibPQ.execute(conn, args...; kws...) - - +""" \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index afe68d0..8795fc0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,7 +18,8 @@ end @testset "_dbconnect function for LibPQ" begin - conn= DBConnector._dbconnect(LibPQ.Connection, ENV["POSTGRES_HOST"],ENV["POSTGRES_USER"], ENV["POSTGRES_PASSWORD"], "omop") + conn= DBConnector._dbconnect(LibPQ.Connection, host = ENV["POSTGRES_HOST"],user = ENV["POSTGRES_USER"], password = ENV["POSTGRES_PASSWORD"], db = "omop") + @test @isdefined conn end