Title: | Integrates with the 'RStudio' Connections Pane and 'pins' |
Version: | 0.2.0 |
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. |
License: | MIT + file LICENSE |
Imports: | DBI, methods, pins, dplyr, dbplyr, uuid, rscontract |
Suggests: | RSQLite, testthat (≥ 3.0.0), covr |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
URL: | https://github.com/rstudio/connections, https://rstudio.github.io/connections/ |
BugReports: | https://github.com/rstudio/connections/issues |
Config/testthat/edition: | 3 |
Config/Needs/website: | tidyverse/tidytemplate |
NeedsCompilation: | no |
Packaged: | 2023-12-17 21:25:13 UTC; edgar |
Author: | Edgar Ruiz [aut, cre], Posit Software, PBC [cph, fnd] |
Maintainer: | Edgar Ruiz <edgar@posit.co> |
Repository: | CRAN |
Date/Publication: | 2023-12-18 18:10:02 UTC |
DBI methods
Description
Implementations of pure virtual functions defined in the 'DBI' package.
Usage
## S4 method for signature 'connConnection,ANY'
dbWriteTable(conn, name, value, ...)
## S4 method for signature 'connConnection'
dbSendQuery(conn, statement, ...)
Arguments
conn |
A DBIConnection object, as returned by
|
name |
The table name, passed on to
|
value |
a data.frame (or coercible to data.frame). |
... |
Other parameters passed on to methods. |
statement |
a character string containing SQL. |
Close a connection
Description
Close a connection
Usage
connection_close(con, host = "", type = "", leave_open = FALSE)
Arguments
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 |
Value
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
Examples
library(DBI)
con <- connection_open(RSQLite::SQLite(), path = ":dbname:")
connection_close(con)
con
Displays the code that will be used to recreate the connection
Description
Displays the code that will be used to recreate the connection
Usage
connection_code(con)
Arguments
con |
A 'connConnection' object |
Value
It prints out the lines of code that this package will use to reconnect to the database.
Opens a connection
Description
Opens a connection
Usage
connection_open(..., open_pane = TRUE)
Arguments
... |
Passes arguments to wrapped connection function |
open_pane |
Signals for the RStudio Connections pane to open. Defaults to TRUE. |
Value
Returns a NULL object. If using the RStudio IDE, it will attempt to open the connection
Examples
library(DBI)
con <- connection_open(RSQLite::SQLite(), path = ":dbname:")
con
connection_close(con)
Retrieves a database connection or query from a board
Description
Retrieves a database connection or query from a board
Usage
connection_pin_read(board, name, version = NULL)
Arguments
board |
A 'pins' board object |
name |
The name of the pin |
version |
The version of the pin to get (optional) |
Value
It will return either the database connection, or the remote table from a database.
Writes a database connection or query to a board
Description
Writes a database connection or query to a board
Usage
connection_pin_write(board, x, ...)
Arguments
board |
A 'pins' board object |
x |
A 'connections' table or database connection |
... |
Additional arguments to pass to 'pins::pin_write()' |
Value
It returns no output.
Refreshes a connection
Description
Refreshes a connection
Usage
connection_update(con, hint = "")
Arguments
con |
Connection variable |
hint |
Optional argument passed to the Contract |
Value
Returns a NULL object. If using the RStudio IDE, it will attempt to refresh the connection identified by attributes of the con object
Examples
library(DBI)
con <- connection_open(RSQLite::SQLite(), path = ":dbname:")
connection_update(con)
connection_close(con)
Populates the RStudio Connection viewer
Description
Populates the RStudio Connection viewer
Usage
connection_view(
con,
connection_code = "",
host = "",
name = "",
connection_id = ""
)
Arguments
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 |
Value
It populates the RStudio Connections pane. It returns nothing to the console or session.
Examples
library(DBI)
con <- connection_open(RSQLite::SQLite(), path = ":dbname:")
connection_view(con)
connection_close(con)