src_dbi | R Documentation |
These functions have been deprecated; instead please use tbl()
directly on an DBIConnection
. See https://dbplyr.tidyverse.org/ for
more details.
src_mysql(
dbname,
host = NULL,
port = 0L,
username = "root",
password = "",
...
)
src_postgres(
dbname = NULL,
host = NULL,
port = NULL,
user = NULL,
password = NULL,
...
)
src_sqlite(path, create = FALSE)
dbname |
Database name |
host, port |
Host name and port number of database |
... |
for the src, other arguments passed on to the underlying
database connector, |
user, username, password |
User name and password. Generally, you should avoid saving username and password in your
scripts as it is easy to accidentally expose valuable credentials.
Instead, retrieve them from environment variables, or use database
specific credential scores. For example, with MySQL you can set up |
path |
Path to SQLite database. You can use the special path ":memory:" to create a temporary in memory database. |
create |
if |
An S3 object with class src_dbi
, src_sql
, src
.
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)
# To retrieve a single table from a source, use `tbl()`
mtcars <- con %>% tbl("mtcars")
mtcars
# You can also use pass raw SQL if you want a more sophisticated query
con %>% tbl(sql("SELECT * FROM mtcars WHERE cyl == 8"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.