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

DBInterface.jl support #206

Open
ValentinKaisermayer opened this issue Oct 29, 2020 · 3 comments
Open

DBInterface.jl support #206

ValentinKaisermayer opened this issue Oct 29, 2020 · 3 comments

Comments

@ValentinKaisermayer
Copy link

The package does not support DBInterface.jl which would be nice for switching databases and to not have to re-write code.

@TheCedarPrince
Copy link
Collaborator

Out of curiosity, what is the status on this?
And what would be the lift required to satisfy the DBInterface interface?
Thanks!

@TheCedarPrince
Copy link
Collaborator

Hey @iamed2 ,

Copying our discussion from Slack to here for context:

PRs are welcome; I'm generally not a fan of generic databases relying on anonymous "prepare" as a verb as that doesn't exist in PostgreSQL and thus requires some hacks. But if something is tested and consistent and doesn't involve generating SQL I'm happy to maintain it once accepted.

Here is an implementation that would satisfy the DBInterface.jl interface based on LibPQ.jl (all credit for @xitology for creating this implementation):

using LibPQ
using DBInterface

DBInterface.connect(::Type{LibPQ.Connection}, args...; kws...) =
    LibPQ.Connection(args...; kws...)

DBInterface.prepare(conn::LibPQ.Connection, args...; kws...) =
    LibPQ.prepare(conn, args...; kws...)

DBInterface.execute(conn::Union{LibPQ.Connection, LibPQ.Statement}, args...; kws...) =
    LibPQ.execute(conn, args...; kws...)

To make it consistent with this repository, if we added documentation similarly how is seen in MySQL.jl, these dispatches, and tests, would that be acceptable for the repo as a PR?
It would introduce DBInterface.jl as a dependency.

@TheCedarPrince
Copy link
Collaborator

Just following up on this -- can I create the PR here to add this support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants