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

Implement RStudio Connection Contract #55

Closed
edgararuiz-zz opened this issue Sep 5, 2017 · 14 comments
Closed

Implement RStudio Connection Contract #55

edgararuiz-zz opened this issue Sep 5, 2017 · 14 comments

Comments

@edgararuiz-zz
Copy link

The Connection Contract integrates the RStudio IDE with the database connection. Here is the link with the details: https://rstudio.github.io/rstudio-extensions/connections-contract.html

@krlmlr
Copy link
Member

krlmlr commented Sep 23, 2017

Rather than implementing the contract in each DBI backend, how about implementing it in DBI itself? Something like

setGeneric("dbConnect",
  def = function(drv, ...) {
    con <- standardGeneric("dbConnect")
    register_con_with_rstudio(con)
    con
  },
  valueClass = "DBIConnection"
)

instead of the current implementation:

setGeneric("dbConnect",
  def = function(drv, ...) standardGeneric("dbConnect"),
  valueClass = "DBIConnection"
)

? The same for dbDisconnect(). To catch disconnects that happen through garbage collection, we could register a finalizer on the external pointer that lives in the connection.

@jimhester @javierluraschi @edgararuiz: Thoughts?

@edgararuiz-zz
Copy link
Author

edgararuiz-zz commented Sep 23, 2017 via email

@russellpierce
Copy link

What dependencies (if any) will this add to DBI or RMariaDB?

@edgararuiz-zz
Copy link
Author

None that I can see, I checked the instructions (http://db.rstudio.com/advanced/contract) and odbc's implementation of the Contract: https://github.com/rstats-db/odbc/blob/5acc55350e0664002d6281f4659c089911fbd7c3/R/Viewer.R

@jimhester
Copy link

I would prefer having this in DBI as well. @jmcphers would probably be the person to consult about what changes were necessary in DBI to get this working for all compliant backends.

@nwstephens
Copy link

I would love to see the connection contract implemented in DBI. What's the status on this? @krlmlr

@krlmlr
Copy link
Member

krlmlr commented Nov 14, 2017

Will look at it in December. In the meantime, happy to review ideas/PRs in the DBI package ;-)

@jtelleriar
Copy link

jtelleriar commented Nov 15, 2017 via email

@edgararuiz-zz
Copy link
Author

@krlmlr - I started working on the contract, and what I have so far works well for DBs that have no schemata. For databases with more than one schema, dbListTables() does not provide enough data to create a tree that the user can drill into (db-schema-table/view), and there's no dbListSchemas() command available. We could implement something w/o displaying the schema, but that will mean that the user will not know which schema to use when the try to call it via dbGetQuery() for example. Thoughts?

cc @nwstephens

@krlmlr
Copy link
Member

krlmlr commented Nov 27, 2017

@edgararuiz: Schema support is pending (r-dbi/DBI#24), I'll tackle it later in December. Would you mind sharing your current implementation so that we can discuss there?

@edgararuiz-zz
Copy link
Author

@krlmlr - Sounds good, here's the link to the Gist: https://gist.github.com/edgararuiz/0533b3daf70a41b70acd75c1e6a2b7a3

It is essentially a simplified version of the odbc's package contract: https://github.com/r-dbi/odbc/blob/master/R/Viewer.R

@edgararuiz-zz
Copy link
Author

@krlmlr - as an aside, what are the plans for other DB elements, like enumerating databases inside a server? Ideally, we should be able to list databases inside a server, schemata inside a database, tables/views inside a schema. Also, are the plans to add more metadata to dbListTables() so we can see differentiate between tables and views?

@krlmlr
Copy link
Member

krlmlr commented Dec 4, 2017

@edgararuiz: We should be able to support most of what you're suggesting, please see #24 for details.

Closing in favor of https://github.com/r-dbi/DBI/issues/211.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2020

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.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2020
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

6 participants