-
Notifications
You must be signed in to change notification settings - Fork 2
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
Simplification of the open/connection interface #14
Comments
open
interface
open
interface
Creating a more unified backend approach is a great idea. Not late at all. Technically, the only backend that connects with the All the other backends (except SQLite) are as follows:
So the user is actually having to load the specific package they need and set up the connection. That being said, unifying how the connect is made would be lovely so one function would be used for all and the the user wouldn't have to load the libraries anymore (although duckdb and SQLite are a bit different because they're local unlike the others) Is that along the lines of what you were thinking? |
Right, so a couple of cases came also to my mind:
db = DB.duckdb_connect(mem); Could be something like: db = DB.connect(mem; backend::Backend=duckdb, kwargs...);
@chain DB.db_table(db, :mtcars) begin
...
end Could simply be: @chain DB.table(db, :mtcars) begin
...
end It already has What do you think? |
I like the example of the connection one, I think it's definitely something we could do and then ppl can choose to use the method (original vs Julian) if they want. It wouldn't be a heavy lift to do. For |
Still on this topic: in R I always use the Currently with TidierDB I wrote a simple macro that create a temporary connection and kills it after the collect. It is good enough for me, and fast enough for what I do. |
I'm not familiar with that package. I will take a look at it. Would you might sharing an example with the macro you created? I am not sure killing a connection after the Here are few examples of the
|
When using MariaDB without a pool of connections, it is often the case that the connection died and the collect results in an error. So a safe way to use it is to connect-collect-disconnect. I do this mainly in REST APIs. Suppose we have the function
We can define a macro that substitutes the "con" string with a temporary connection that will be killed after use:
So if I want to write in mariadb, something like this works fine:
or some TidierDB pipeline:
|
I took a look at the pool documentation and then users will have access to the |
Hi all,
This package has so much potential! I want to open a rather late discussion about how the interface to different DBs backends could be more "julian" and maybe friendly. I reckon the idea to stick the most to the "tidyverse" style, but I believe this could also lead to better and refinement "tidy" way.
Currently, connections to the different DBs backends work as:
Right?
So what if, instead, there is a higher method that dispatch according to a
backend
argument (or keyword arg):Then we can expand the backend types, but consistently keep one single function name with$n$ backend methods?
Does this make sense, what do you think about this alternative?
The text was updated successfully, but these errors were encountered: