Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This New branch is building upon the sqlite_test PR as it passed the testsuite #13

Open
wants to merge 58 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
526ca48
Attempt to fix JDBC dispatch for DBInterface
TheCedarPrince Feb 23, 2023
9ea3bd1
Creating test for _dbconnect function of SQLite
Farreeda Mar 17, 2023
ccb0995
fixing the file_path issue
Mar 17, 2023
9f01623
.
Mar 17, 2023
8c81230
updating PR
Mar 18, 2023
120f262
with github secrets
Jul 2, 2023
031dc3c
back to original
Jul 2, 2023
d5091ee
.
Jul 2, 2023
fa48076
updating the path
Jul 3, 2023
2760adc
Added quering
Jul 3, 2023
f6e27db
removing database in the test
Jul 3, 2023
535ff8b
updates
Jul 3, 2023
0e92556
Adding Dataframes and examples
Jul 3, 2023
766149a
.
Jul 3, 2023
43b80c5
.
Jul 3, 2023
6152c9d
allowing the test to access the function for the workflow
Jul 3, 2023
106173a
add / for absolute path :)
Jul 3, 2023
967e798
.
Jul 3, 2023
421f10d
.
Jul 3, 2023
5eadd8e
.
Jul 3, 2023
2d1ed6c
path problems
Jul 3, 2023
fc02a02
.
Jul 3, 2023
fdef69c
.
Jul 3, 2023
b18efea
testing mysql and postgresql #1
Jul 3, 2023
6cf9c35
initial documentation
Jul 3, 2023
d5d8fc8
Cleaned workflow syntax
TheCedarPrince Jul 21, 2023
68060cd
Removed test dependencies and put them into test dependencies
TheCedarPrince Jul 21, 2023
b859b4c
Added author names and comapt and removed test dependencies
TheCedarPrince Jul 21, 2023
8cc1492
Deprecated ODBC JDBC and their dispatch
TheCedarPrince Jul 21, 2023
44544a2
Removed ODBC JDBC functions
TheCedarPrince Jul 21, 2023
aadd240
Updated test suite to work properly
TheCedarPrince Jul 21, 2023
993c107
Added test dependenices
TheCedarPrince Jul 21, 2023
7d2b331
Removed invalidations workflow temporarily
TheCedarPrince Jul 21, 2023
a8054b2
Exploring why pull request is not triggering actions
TheCedarPrince Jul 21, 2023
3913dea
Added proper variable naming
TheCedarPrince Jul 21, 2023
a5315fd
Removed API reference
TheCedarPrince Jul 21, 2023
75389c8
Testing for API error
TheCedarPrince Jul 21, 2023
584f321
Trying to fix up API error
TheCedarPrince Jul 21, 2023
fb64e28
Added necessary import for the API
TheCedarPrince Jul 21, 2023
2fe8cc1
Removed import as not needed
TheCedarPrince Jul 21, 2023
7f4a4b6
Included LibPQ fork until PR is added from LibPQ
TheCedarPrince Jul 21, 2023
d0cb58f
Added authors
TheCedarPrince Jul 21, 2023
2ba693d
Redid postgresql interface
TheCedarPrince Jul 21, 2023
a3b06ba
Finalized tests at the moment
TheCedarPrince Jul 21, 2023
37250d0
Add manifest for test environment
TheCedarPrince Jul 21, 2023
53e1006
Just testing without MySQL server support
TheCedarPrince Jul 21, 2023
f69c868
Added back in MySQL tests
TheCedarPrince Jul 21, 2023
f71cc67
fixing tests
Aug 9, 2023
4bc4225
testing the LibPQ test
Aug 10, 2023
a801308
.
Aug 10, 2023
4b86aba
.
Aug 10, 2023
16bbbbd
.
Aug 10, 2023
d2571d2
.
Aug 10, 2023
fd52e17
fixing postgres function
Aug 23, 2023
71efece
checking it is not env error
Aug 23, 2023
41e8e02
again
Aug 23, 2023
666bc10
sql same
Aug 24, 2023
503bbe9
kwargs for mysql and postgresql
Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to change the syntax to get this to re-trigger but it is now working.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches: [main]
tags: ["*"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
Expand Down Expand Up @@ -46,6 +47,15 @@ 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:
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/invalidations.yml

This file was deleted.

9 changes: 6 additions & 3 deletions Project.toml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated authors and compat entries.

Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
name = "DBConnector"
uuid = "5242bac9-aa14-4800-b46b-fcd14df13057"
version = "1.0.0"
authors = ["Jacob Zelko <[email protected]>", "Fareeda Abdelazeez"]
version = "0.1.0"

[deps]
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
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]
DBInterface = "2.5"
LibPQ = "1.15"
MySQL = "1.4"
SQLite = "1.6"
julia = "1.6"

[extras]
Expand Down
32 changes: 29 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
using Documenter, Example
using Documenter

makedocs(modules = [Example], sitename = "Example.jl")
makedocs(;
modules = [DBConnector],
authors = "Jacob Zelko (aka TheCedarPrince) <[email protected]> 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",
)
73 changes: 73 additions & 0 deletions docs/src/Tutorials/MySQL.md
Original file line number Diff line number Diff line change
@@ -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
49 changes: 49 additions & 0 deletions docs/src/Tutorials/SQLite.md
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions docs/src/Tutorials/postgreSQL.md
Original file line number Diff line number Diff line change
@@ -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
21 changes: 16 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -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]
```
11 changes: 11 additions & 0 deletions docs/src/tutorials.md
Original file line number Diff line number Diff line change
@@ -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
16 changes: 1 addition & 15 deletions src/DBConnector.jl
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overhauled this a little to deprecate some support for ODBC and JDBC connections as well as add a proper import.

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ module DBConnector
using DBInterface
using LibPQ
using SQLite
using ODBC
using JDBC
using MySQL
import MySQL: API

include("postgresql.jl")
include("sqlite.jl")
include("mysql.jl")
include("odbc.jl")
include("jdbc.jl")

function DBConnection(dbms; kws...)

Expand All @@ -25,17 +22,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
Loading