Learn R Programming

redshift (version 0.5)

redshift.unload: Unloads aquery to AWS S3 cloud

Description

Unloads a redshift query to the AWS S3 cloud

Usage

redshift.unload(conn, query, filename, aws.accesskey = '', aws.secretkey = '', delim = ',', allowOverwrite = TRUE, parallel = TRUE, zip = TRUE, addquotes = FALSE, aws.role = '' )

Arguments

conn
The database connection
query
The Query to be unloaded
filename
The destination file path and name
aws.accesskey
The AWS Access Key. Defaults to '' but see note.
aws.secretkey
The AWS Secret Key. Defaults to '' but see note.
delim
The Delimiter to be used. Defaults to ','
allowOverwrite
Logical. Allow Redshift to overwrite existing files with same name? Defaults to TRUE.
parallel
Logical. Allow Redshift to run parallelqueries and create multiple files? Defaults to TRUE.
zip
Logical. Allow Redshift to dump a zipped file? Defaults to TRUE.
addquotes
Logical. Wrap quotations marks around wach field. Defaults to TRUE.
aws.role
The AWS Role. Defaults to '' but see note.

Value

NA

Examples

Run this code
require(redshift)
# conn <- redshift.connect("jdbc:postgresql://blah.blah.eu-west-1.redshift.amazonaws.com:5439/data", "username", "password")
#redshift.unload(conn,query = "SELECT * from mytable where name like 'Eeshan'",filename = "s3://Eeshan/files/test.txt",aws.accesskey = <AWS Access Key>,aws.secretkey = <AWS Secret Key>,delim = ",",parallel = F)
#redshift.unload(conn,query = "SELECT * from mytable where name like 'Richard'",filename = "s3://Richard/files/test.txt",aws.role = <AWS Role>,delim = ",",parallel = F)

Run the code above in your browser using DataLab