db_snowflake_copy: Perform a COPY INTO in Snowflake to perform a load or unload...

View source: R/src-snowflakedb.R

db_snowflake_copyR Documentation

Perform a COPY INTO in Snowflake to perform a load or unload operation.

Description

Perform a COPY INTO in Snowflake to perform a load or unload operation.

Usage

db_snowflake_copy(con, from, to, format_opts = list())

Arguments

con

A SnowflakeDBConnection object.

from

The source of the data, i.e., what comes after the FROM in the COPY statement. This can be a table, a subquery, a stage, or a local file.

to

The target of the COPY statement as a string. This can be a S3/Azure/local filesystem location, a table, or a Snowflake stage.

format_opts

A list of key-value pairs for the Snowflake COPY file_format options.

Examples

## Not run: 
# Connection basics ---------------------------------------------------------
# To connect to a database first create a src:
my_db <- src_snowflakedb(user = "snowman",
                         password = "letitsnow",
                         account = "acme",
                         opts = list(warehouse = "mywh",
                                     db = "mydb",
                                     schema = "public")
# Copy from a local CSV file to a target table in my_db.
db_snowflake_copy(my_db$con, from = "file:///my/directory/foo.csv", to = "target_table", 
format_opts = list(format = 'csv', field_delimiter = ','))

## End(Not run)

snowflakedb/dplyr-snowflakedb documentation built on April 2, 2022, 5:43 a.m.