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

Simplify dbdir entrypoint #171

Open
JosiahParry opened this issue May 25, 2024 · 0 comments
Open

Simplify dbdir entrypoint #171

JosiahParry opened this issue May 25, 2024 · 0 comments

Comments

@JosiahParry
Copy link

At present, there are two places where the database directory can be specified for a DuckDB database instance. Either in the driver or in the connection functions respectively.

By having two places to specify the dbdir argument it is a bit confusing to know which is the preference. Then, there is a possible point of confusion where a database path may be specified in the driver but another in the connection function. And when this happens the path specified in dbConnect() silently takes precedence.

My personal preference would be that there is only one place to specify the path (it feels best to be in the driver, imo). Otherwise, there should be an error or a warning when setting dbir in dbConnect() when one is already provided by duckdb()

library(duckdb)

dbConnect(duckdb("mydb.duckdb"))
#> <duckdb_connection 76150 driver=<duckdb_driver dbdir='/reprex-7acf7dd015ed-sappy-tern/mydb.duckdb' read_only=FALSE bigint=numeric>>

dbConnect(duckdb(), "mydb.duckdb")
#> <duckdb_connection 8e300 driver=<duckdb_driver dbdir='/reprex-7acf7dd015ed-sappy-tern/mydb.duckdb' read_only=FALSE bigint=numeric>>

dbConnect(duckdb("a-different.duckdb"), "mydb.duckdb")
#> <duckdb_connection 3c7a0 driver=<duckdb_driver dbdir='/reprex-7acf7dd015ed-sappy-tern/mydb.duckdb' read_only=FALSE bigint=numeric>>

Created on 2024-05-24 with reprex v2.1.0

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

No branches or pull requests

1 participant