Title: | Integrates with the 'RStudio' Connections Pane and 'pins' |
---|---|
Description: | Enables 'DBI' compliant packages to integrate with the 'RStudio' connections pane, and the 'pins' package. It automates the display of schemata, tables, views, as well as the preview of the table's top 1000 records. |
Authors: | Edgar Ruiz [aut, cre], Posit Software, PBC [cph, fnd] |
Maintainer: | Edgar Ruiz <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2024-11-13 04:13:51 UTC |
Source: | https://github.com/rstudio/connections |
Close a connection
connection_close(con, host = "", type = "", leave_open = FALSE)
connection_close(con, host = "", type = "", leave_open = FALSE)
con |
Connection variable |
host |
Host name of the connection. Optional, defaults to empty |
type |
Type of connection. Optional, defaults to empty |
leave_open |
Should the connection be left open. Defaults to FALSE |
Returns a NULL object. If using the RStudio IDE, it will attempt to close the connection identified by the 'host' and 'type' arguments, or the con object
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") connection_close(con) con
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") connection_close(con) con
Displays the code that will be used to recreate the connection
connection_code(con)
connection_code(con)
con |
A 'connConnection' object |
It prints out the lines of code that this package will use to reconnect to the database.
Opens a connection
connection_open(..., open_pane = TRUE)
connection_open(..., open_pane = TRUE)
... |
Passes arguments to wrapped connection function |
open_pane |
Signals for the RStudio Connections pane to open. Defaults to TRUE. |
Returns a NULL object. If using the RStudio IDE, it will attempt to open the connection
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") con connection_close(con)
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") con connection_close(con)
Retrieves a database connection or query from a board
connection_pin_read(board, name, version = NULL)
connection_pin_read(board, name, version = NULL)
board |
A 'pins' board object |
name |
The name of the pin |
version |
The version of the pin to get (optional) |
It will return either the database connection, or the remote table from a database.
Writes a database connection or query to a board
connection_pin_write(board, x, ...)
connection_pin_write(board, x, ...)
board |
A 'pins' board object |
x |
A 'connections' table or database connection |
... |
Additional arguments to pass to 'pins::pin_write()' |
It returns no output.
Refreshes a connection
connection_update(con, hint = "")
connection_update(con, hint = "")
con |
Connection variable |
hint |
Optional argument passed to the Contract |
Returns a NULL object. If using the RStudio IDE, it will attempt to refresh the connection identified by attributes of the con object
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") connection_update(con) connection_close(con)
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") connection_update(con) connection_close(con)
Populates the RStudio Connection viewer
connection_view( con, connection_code = "", host = "", name = "", connection_id = "" )
connection_view( con, connection_code = "", host = "", name = "", connection_id = "" )
con |
Connection variable |
connection_code |
Text of code to connect to the same source |
host |
Name of Host of the connection |
name |
Connection name |
connection_id |
Unique ID of the connection for the current session |
It populates the RStudio Connections pane. It returns nothing to the console or session.
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") connection_view(con) connection_close(con)
library(DBI) con <- connection_open(RSQLite::SQLite(), path = ":dbname:") connection_view(con) connection_close(con)