-
Notifications
You must be signed in to change notification settings - Fork 74
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
Change argument names of sqlInterpolate() and sqlParseVariables() #147
Comments
- Remove `valueClass = "logical"` for those generics where the return value is meaningless, to allow backends to return invisibly (#135). - New `dbQuoteIdentifier(DBIConnection, list)` to support quoting multi-component identifiers such as tables in a schema (#71). DBI backends should implement this method for schema support. - Renamed arguments to `sqlInterpolate()` and `sqlParseVariables()`, the former gains a `.dots` argument (#140, #147). until RSQLite 1.1 has been built for OS X - Remove `max.connections` requirement from documentation (#56). - Enable `dbBind()` example (#136). - Use roxygen2 inheritance to copy DBI specification to this package. - Avoid using braces in the definitions of generics if possible, so that standard generics can be detected (#146). - Change `omegahat.org` URL to `omegahat.net`, the particular document still doesn't exist below the new domain. - Use `tic` package for building documentation.
@bborgesr @javierluraschi: I think I have found a way to declare the generic so that it's compatible with both the old and new signatures. |
@krlmlr, That's not yet implemented, right? I still get an error... |
No, please watch this issue. (And I'm not so sure anymore... We'll figure out something.) |
Could you please test your packages with devtools::install_github("rstats-db/DBI@b-%23147-dots-only") ? It's a bit hacky (see diff), but should work with both the old and the new interfaces. If it works, this allows us to:
See |
Wow, clever! It works for me. @krlmlr, please let me know when you release DBI to CRAN (with this change) and I'll make sure to update the implementations of |
Good news! I'm not releasing to CRAN any time soon, but you should be able to update the implementations to the new signature on GitHub (and use |
On the other hand, why force people to use the GitHub version of DBI? The safer approach would be indeed to wait for the CRAN release of DBI. |
@krlmlr |
- `sqlParseVariables()` and `sqlInterpolate()` have `...` as exported formals. DBI drivers are expected to implement `sqlParseVariables(conn, sql, ..., .dots)` and `sqlInterpolate(conn, sql, ...)`. Dispatch occurs manually, overriding default S4 logic. This is a temporary workaround, DBI 0.7 will export the correct signature, and backends not adhering to this signature will not be able to load (#147).
- `sqlParseVariables()` and `sqlInterpolate()` have `...` as exported formals. DBI drivers are expected to implement `sqlParseVariables(conn, sql, ..., .dots)` and `sqlInterpolate(conn, sql, ...)`. Dispatch occurs manually, overriding default S4 logic. This is a temporary workaround, DBI 0.7 will export the correct signature, and backends not adhering to this signature will not be able to load (#147).
Will release DBI to CRAN soon, if all revdep checks pass, and then change the signature of these functions in the dev version. |
@krlmlr with the dev version of
To exit cleanly then run:
Is this expected? |
@javierluraschi: No. I guess this means that I revert my evil, evil hack, and we coordinate the release of DBI and sparklyr. What would be a convenient date for you? BTW, sorry it took me so long. I thought I'd need to install Spark, but you actually did submit a reprex ;-) Neat! |
@bborgesr: Since pool isn't on CRAN yet, would you mind adding a |
- Revert `...` hack for `sqlInterpolate()` and `sqlParseVariables()`, simply renamed arguments (#147). - Added specification from DBItest to methods documentation. Affected methods: `dbConnect()`, `dbDisconnect()`, `dbDataType()`, `dbSendQuery()`, `dbFetch()`, `dbClearResult()`, `dbGetQuery()`, `dbSendStatement()`, `dbExecute()`, `dbQuoteIdentifier()`, `dbQuoteString()`, `dbReadTable()`, `dbWriteTable()`, `dbRemoveTable()`, `dbExistsTable()`, and `dbListTables()` (#129). - Added default implementation for `dbReadTable()`. - Removed `dbQuoteIdentifier(DBIConnection, list)` again. - Improved default implementation of `dbQuoteString()` and `dbQuoteIdentifier()` (#77). - Removed `tryCatch()` call in `dbGetQuery()` (#113).
@krlmlr: I'm not sure what's the lesser evil: the people who will be annoyed if pool is not compatible with the latest DBI devel, or the people who will be annoyed if pool with not compatible with DBI from CRAN. But I'll certainly switch to the new notation and merge that into master as soon as DBI hits CRAN. On a different note, this wasn't introduced now, but is there a reason that the |
Thanks. I'll double-check the documentation, I wonder why R CMD check hasn't noticed this. For the time being, you could tag/branch the current state of remotes::install_github("rstudio/pool") # devel DBI
remotes::install_github("rstudio/pool@stable") # CRAN DBI from stable tag/branch |
- Interface changes - Deprecated `dbDriver()` and `dbUnloadDriver()` by documentation (#21). - Renamed arguments to `sqlInterpolate()` and `sqlParseVariables()` to be more consistent with the rest of the interface, and added `.dots` argument to `sqlParseVariables`. DBI drivers are now expected to implement `sqlParseVariables(conn, sql, ..., .dots)` and `sqlInterpolate(conn, sql, ...)` (#147). - Interface enhancements - Removed `valueClass = "logical"` for those generics where the return value is meaningless, to allow backends to return invisibly (#135). - Avoiding using braces in the definitions of generics if possible, so that standard generics can be detected (#146). - Added default implementation for `dbReadTable()`. - All standard generics are required to have an ellipsis (with test), for future extensibility. - Improved default implementation of `dbQuoteString()` and `dbQuoteIdentifier()` (#77). - Removed `tryCatch()` call in `dbGetQuery()` (#113). - Documentation improvements - Finalized first draft of DBI specification, now in a vignette. - Most methods now draw documentation from `DBItest`, only those where the behavior is not finally decided don't do this yet yet. - Removed `max.connections` requirement from documentation (#56). - Improved `dbBind()` documentation and example (#136). - Change `omegahat.org` URL to `omegahat.net`, the particular document still doesn't exist below the new domain. - Internal - Use roxygen2 inheritance to copy DBI specification to this package. - Use `tic` package for building documentation. - Use markdown in documentation.
@krlmlr I would like to pass parameters into a sql chunk and was wondering if you could point me to the right direction. I have asked this here: r-dbi/bigrquery#391 : I am trying to work out if there is a way to pass parameters to the # {r setup}
library(bigrquery)
bq_auth(path = "access_token.json")
db <- dbConnect(
bigquery(),
dataset = 'my_data',
project = 'my-project',
use_legacy_sql = FALSE
)
parameter_value = 10L
-- {sql, echo=FALSE, connection=db, output.var="x"}
SELECT @parameter_value # {r output}
print(x)
# I want to see 10 here. I am happy to contribute if changes are required on |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
Use
conn
andsql
instead of_con
and_sql
.Also add
.dots
argument: #140 (comment).The text was updated successfully, but these errors were encountered: