Learn R Programming

civis (version 3.0.0)

query_civis_file: Export results from a query to S3 and return a file id.

Description

Exports results from a Redshift SQL query, and returns the id of the file on S3 for use with read_civis or download_civis.

Usage

query_civis_file(x, ...)

# S3 method for character query_civis_file( x, database = NULL, job_name = NULL, hidden = TRUE, verbose = verbose, csv_settings = NULL, ... )

# S3 method for sql query_civis_file( x, database = NULL, job_name = NULL, hidden = TRUE, verbose = FALSE, csv_settings = NULL, ... )

# S3 method for numeric query_civis_file(x, database = NULL, verbose = FALSE, ...)

Arguments

x

"schema.table", sql("query"), or a sql script job id.

...

Options passed to scripts_post_sql, including credential.

database

string, Name of database where data frame is to be uploaded. If no database is specified, uses options(civis.default_db).

job_name

string, Name of the job (default: "Civis S3 Export Via R Client").

hidden

bool, Whether the job is hidden.

verbose

bool, Set to TRUE to print intermediate progress indicators.

csv_settings

See scripts_post_sql for details.

Methods (by class)

  • character: Export a "schema.table" to a file id.

  • sql: Export results of a query to a file id.

  • numeric: Run an existing sql script and return the file id of the results on S3.

Details

By default, the export uses the default csv_settings in scripts_post_sql, which is a gzipped csv.

See Also

Other io: download_civis(), query_civis(), read_civis(), write_civis_file(), write_civis()

Examples

Run this code
if (FALSE) {
id <- query_civis_file("schema.tablename", database = "my_database")
df <- read_civis(id, using = read.csv)

query <- sql("SELECT * FROM table JOIN other_table USING id WHERE var1 < 23")
id <- query_civis_file(query)
df <- read_civis(id, using = read.csv)

id <- query_civis_file(query_id, credential_id = 0000)
df <- read_civis(id, using = read.csv)
}

Run the code above in your browser using DataLab