Open krlmlr opened 6 years ago
This might need to wait until we have fleshed out r-dbi/DBI#24 in DBI.
A function that wraps connectionUpdated()
can be added to DBI operations that make changes to the DB, such as dbWriteTable()
and dbRemoveTable()
.
@krlmlr Just checking in on this issue. We consistently find ourselves wanting to demo RSQLite connections with Shiny apps. It would be great to have the connections contract working for Shiny developers who want to use database backends.
@jimhester: Do you have time to look into this?
Just agreed with @edgararuiz that he would take a look.
dbiRegisterCallbacks()
and dbiUnregisterCallbacks()
dbiRegisterCallbacks <- function(name, ..., connect, disconnect, write_table, remove_table, clear_result)
dbiUnregisterCallbacks <- function(name)
Is this still blocked? I have a use case for it.
The yet-to-be-implemented conmgr will handle all new connections. In DBI, we'll call methods in conmgr if this package is installed. Clients will be able to register their own callbacks there.
@krlmlr I see that conmgr has been archived. Are there any new plans w.r.t. RStudion Connection Contracts in DBI?
The connections package seems to wrap "DBIConnection"
objects to achieve the desired result. I suspect we can simplify life for that package by providing callbacks.
https://github.com/rstudio/connections looks like the way to go. Perhaps we can provide connection events as part of a rewrite. Closing for now, bookmarking this issue.
Right, connections
is an external package the wraps DBI
so it can open, update and close the Connections pane. The idea would be integrate the routines from connections
into DBI
. connections
has a dependency on rscontract
(https://github.com/rstudio/rscontract). The rscontract
package is an interface tool that makes it easier to create and customize the Contract. I can see that eventually, DBI
would have that same dependency.
Link: https://rstudio.github.io/rstudio-extensions/connections-contract.html
Should be possible by changing the implementation of the generic to
instead of the current implementation:
Similar for
dbDisconnect()
. I'm not sure about theconnectionUpdated()
entry point, because DBI currently doesn't provide notification.Implementation sketch by @edgararuiz: https://gist.github.com/edgararuiz/0533b3daf70a41b70acd75c1e6a2b7a3.
Happy to review a PR. CC @nwstephens @jimhester.