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

Documentation: if DBI::dbConnect() is the way to connect dplyr to DBs then should require initExtension() #3150

Closed
JohnMount opened this issue Oct 19, 2017 · 1 comment

Comments

@JohnMount
Copy link

If DBI::dbConnect() is now the preferred way to connect dplyr to DBs then the documentation should include how to trigger initExtension() (or the equivalent) for each common database. For example this is functionality that is in dplyr::src_sqlite(), but not triggered when using DBI::dbConnect() directly on a SQLite database. This means switching the connection method can break downstream code.

Example:

suppressPackageStartupMessages(library("dplyr"))
packageVersion("dplyr")
#> [1] '0.7.4'

d <- data.frame(x = 1:2)
small <- 1

# SQLite example

#my_db <- dplyr::src_sqlite(":memory:", create = TRUE)
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
#RSQLite::initExtension(my_db) # needed for many summary fns.

dSQLite <- copy_to(my_db, d, 'dSQLite')

dSQLite %>% 
  mutate(z = STDEV(x))
#> Error in rsqlite_send_query(conn@ptr, statement): no such function: STDEV
@hadley
Copy link
Member

hadley commented Oct 23, 2017

I think we should just handle this in RSQLite: r-dbi/RSQLite#236

@hadley hadley closed this as completed Oct 23, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants