dplyr_source_function_implementations: dplyr integration to connect to a table in a database.

tbl.src_prestoR Documentation

dplyr integration to connect to a table in a database.

Description

Use src_presto to connect to an existing database, and tbl to connect to tables within that database. If you're unsure of the arguments to pass, please ask your database administrator for the values of these variables.

Automatically create a Presto remote database source to wrap aroudn the PrestoConnection object via which DBI APIs can be called.

Usage

## S3 method for class 'src_presto'
tbl(src, from, ..., vars = NULL)

## S3 method for class 'PrestoConnection'
tbl(src, from, ...)

## S3 method for class 'src_presto'
copy_to(
  dest,
  df,
  name = deparse(substitute(df)),
  overwrite = FALSE,
  ...,
  with = NULL
)

## S3 method for class 'PrestoConnection'
copy_to(
  dest,
  df,
  name = deparse(substitute(df)),
  overwrite = FALSE,
  ...,
  with = NULL
)

Arguments

src

A PrestoConnection object produced by DBI::dbConnect().

from

Either a string (giving a table name) or a literal dbplyr::sql() string.

...

Passed on to dbplyr::tbl_sql()

vars

Provide column names as a character vector to avoid retrieving them from the database.

dest

remote data source

df

local data frame

name

name for new remote table.

overwrite

If TRUE, will overwrite an existing table with name name. If FALSE, will throw an error if name already exists.

with

An optional WITH clause for the CREATE TABLE statement.

Examples

## Not run: 
# First create a database connection with src_presto, then reference a tbl
# within that database
my_db <- src_presto(
  catalog = "memory",
  schema = "default",
  user = Sys.getenv("USER"),
  host = "http://localhost",
  port = 8080,
  session.timezone = "Asia/Kathmandu"
)
my_tbl <- tbl(my_db, "my_table")

## End(Not run)
## Not run: 
# First create a database connection, then reference a tbl within that
# database
my_con <- DBI::dbConnect(
  catalog = "memory",
  schema = "default",
  user = Sys.getenv("USER"),
  host = "http://localhost",
  port = 8080,
  session.timezone = "Asia/Kathmandu"
)
my_tbl <- tbl(my_con, "my_table")

## End(Not run)

RPresto documentation built on Nov. 2, 2023, 5:58 p.m.