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

[FEATURE] Test Set for SQLite Connection #3

Open
1 task
TheCedarPrince opened this issue Mar 14, 2023 · 2 comments
Open
1 task

[FEATURE] Test Set for SQLite Connection #3

TheCedarPrince opened this issue Mar 14, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@TheCedarPrince
Copy link
Collaborator

Currently, the test set for the SQLite integration via SQLite.jl does not exist yet. We need a test set that covers the following functions within sqlite.jl:

  • _dbconnect - this function is the core dispatch within DBConnector.jl and is exported for a user

Since SQLite.jl satisfies the DBInterface, creating a test set should be very straightforward. One can create a test that passes a SQLite.DB object to this dispatch and then makes sure that an error does not occur when returning a DBInterface.connect object.

@TheCedarPrince TheCedarPrince added enhancement New feature or request help wanted Extra attention is needed labels Mar 14, 2023
@Farreeda Farreeda mentioned this issue Mar 17, 2023
@Farreeda
Copy link
Collaborator

Looking at this script
`julia> using SQLite

julia> using Test

julia> conn1=DBInterface.connect(SQLite.DB,"Far.db")
SQLite.DB("Far.db")

julia> function _dbconnect(connector::Type{SQLite.DB}, file_path::String)

       return connector(file_path)

   end

_dbconnect (generic function with 1 method)

julia>

julia> conn2 = _dbconnect(SQLite.DB,"Far.db")
SQLite.DB("Far.db")

julia> @test conn1==conn2
Test Failed at REPL[6]:1
Expression: conn1 == conn2
Evaluated: SQLite.DB("Far.db") == SQLite.DB("Far.db")
ERROR: There was an error during testing

julia> conn3=DBInterface.connect(SQLite.DB,"Far.db")
SQLite.DB("Far.db")

julia> @test conn3==conn1
Test Failed at REPL[8]:1
Expression: conn3 == conn1
Evaluated: SQLite.DB("Far.db") == SQLite.DB("Far.db")
ERROR: There was an error during testing
`
I think it means that the error is NOT within the function

@Farreeda
Copy link
Collaborator

Also I added tables with conn2 (generated by the _dbconnect function) using this line of code
DBInterface.execute(conn2,"CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) )")
and asked to view the table name using conn3 (generated from DBInterface.connect) using this line
DBInterface.execute(conn2,"SELECT * FROM Persons") |>DataFrame
and it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants