{"action":"created","comment":{"url":"https://api.github.com/repos/civisanalytics/civis-r/pulls/comments/171603665","pull_request_review_id":100485495,"id":171603665,"diff_hunk":"@@ -609,6 +610,79 @@ query_civis.character <- function(x, database = NULL, verbose = FALSE, ...) {\n   await(queries_get, id = q_id, .verbose = verbose)\n }\n \n+#' Export results from a query to S3 and return a file id.\n+#'\n+#' Exports results from a Redshift SQL query, and returns the id of the file on S3 for use\n+#' with \\code{\\link{read_civis}} or \\code{\\link{download_civis}}.\n+#'\n+#' @param x \"schema.table\", \\code{sql(\"query\")}, or a query id.\n+#' @param database string, Name of database where data frame is to be uploaded.\n+#' If no database is specified, uses \\code{options(civis.default_db)}.\n+#' @param job_name string, Name of the job (default: \\code{\"Civis S3 Export Via R Client\"}).\n+#' @param hidden bool, Whether the job is hidden.\n+#' @param verbose bool, Set to TRUE to print intermediate progress indicators.\n+#' @param csv_settings See \\code{\\link{scripts_post_sql}} for details.\n+#' @param ... unused.\n+#' @export\n+#' @family io\n+#' @details\n+#' By default, the export uses the default csv_settings in \\code{\\link{scripts_post_sql}},\n+#' which is a gzipped csv.\n+#' @examples\n+#' \\dontrun{\n+#' id <- query_civis_file(\"schema.tablename\", database = \"my_database\")\n+#' df <- read_civis(id, using = read.csv)\n+#'\n+#' query <- sql(\"SELECT * FROM table JOIN other_table USING id WHERE var1 < 23\")\n+#' id <- query_civis_file(query)\n+#' df <- read_civis(id, using = read.csv)\n+#'\n+#' id <- query_civis_file(query_id)\n+#' df <- read_civis(id, using = read.csv)\n+#' }\n+query_civis_file <- function(x, ...){\n+  UseMethod(\"query_civis_file\")\n+}\n+\n+#' @export\n+#' @describeIn query_civis_file Export a \\code{\"schema.table\"} to a file id.\n+query_civis_file.character <- function(x, database = NULL, job_name = NULL, hidden = TRUE,\n+                                       verbose = verbose, csv_settings = NULL, ...) {\n+  if (stringr::str_detect(tolower(x), \"\\\\bselect\\\\b\")) {\n+    msg <- c(\"Argument x should be \\\"schema.tablename\\\". Did you mean x = sql(\\\"...\\\")?\")\n+    stop(msg)\n+  }","path":"R/io.R","position":62,"original_position":62,"commit_id":"d00926fbf2a587fbf88273fbdb079c08d6d814ea","original_commit_id":"e723660d60613d82e5be8c24b96f09014f87347e","user":{"login":"patr1ckm","id":427445,"avatar_url":"https://avatars3.githubusercontent.com/u/427445?v=4","gravatar_id":"","url":"https://api.github.com/users/patr1ckm","html_url":"https://github.com/patr1ckm","followers_url":"https://api.github.com/users/patr1ckm/followers","following_url":"https://api.github.com/users/patr1ckm/following{/other_user}","gists_url":"https://api.github.com/users/patr1ckm/gists{/gist_id}","starred_url":"https://api.github.com/users/patr1ckm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patr1ckm/subscriptions","organizations_url":"https://api.github.com/users/patr1ckm/orgs","repos_url":"https://api.github.com/users/patr1ckm/repos","events_url":"https://api.github.com/users/patr1ckm/events{/privacy}","received_events_url":"https://api.github.com/users/patr1ckm/received_events","type":"User","site_admin":false},"body":"Thanks, we do it for `read_civis` and `download_civis` too.","created_at":"2018-03-01T15:56:41Z","updated_at":"2018-03-01T15:56:41Z","html_url":"https://github.com/civisanalytics/civis-r/pull/88#discussion_r171603665","pull_request_url":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/civisanalytics/civis-r/pulls/comments/171603665"},"html":{"href":"https://github.com/civisanalytics/civis-r/pull/88#discussion_r171603665"},"pull_request":{"href":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88"}},"in_reply_to_id":171599998},"pull_request":{"url":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88","id":172104632,"html_url":"https://github.com/civisanalytics/civis-r/pull/88","diff_url":"https://github.com/civisanalytics/civis-r/pull/88.diff","patch_url":"https://github.com/civisanalytics/civis-r/pull/88.patch","issue_url":"https://api.github.com/repos/civisanalytics/civis-r/issues/88","number":88,"state":"open","locked":false,"title":"query_civis_file","user":{"login":"patr1ckm","id":427445,"avatar_url":"https://avatars3.githubusercontent.com/u/427445?v=4","gravatar_id":"","url":"https://api.github.com/users/patr1ckm","html_url":"https://github.com/patr1ckm","followers_url":"https://api.github.com/users/patr1ckm/followers","following_url":"https://api.github.com/users/patr1ckm/following{/other_user}","gists_url":"https://api.github.com/users/patr1ckm/gists{/gist_id}","starred_url":"https://api.github.com/users/patr1ckm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patr1ckm/subscriptions","organizations_url":"https://api.github.com/users/patr1ckm/orgs","repos_url":"https://api.github.com/users/patr1ckm/repos","events_url":"https://api.github.com/users/patr1ckm/events{/privacy}","received_events_url":"https://api.github.com/users/patr1ckm/received_events","type":"User","site_admin":false},"body":"Shall we add some new IO? \r\n\r\n- `query_civis_file.sql` runs the sql and returns the S3 file id\r\n- `query_civis_file.character` exports a `\"schema.table\"` and returns the S3 file id\r\n- `query_civis_file.numeric` exports an existing query id and returns the S3 file id\r\n\r\nCloses #86 ","created_at":"2018-02-28T23:33:52Z","updated_at":"2018-03-01T15:56:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0478002811bf25fd0629c1614d3ba233097bb10","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88/commits","review_comments_url":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88/comments","review_comment_url":"https://api.github.com/repos/civisanalytics/civis-r/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civisanalytics/civis-r/issues/88/comments","statuses_url":"https://api.github.com/repos/civisanalytics/civis-r/statuses/d00926fbf2a587fbf88273fbdb079c08d6d814ea","head":{"label":"patr1ckm:query-civis-file","ref":"query-civis-file","sha":"d00926fbf2a587fbf88273fbdb079c08d6d814ea","user":{"login":"patr1ckm","id":427445,"avatar_url":"https://avatars3.githubusercontent.com/u/427445?v=4","gravatar_id":"","url":"https://api.github.com/users/patr1ckm","html_url":"https://github.com/patr1ckm","followers_url":"https://api.github.com/users/patr1ckm/followers","following_url":"https://api.github.com/users/patr1ckm/following{/other_user}","gists_url":"https://api.github.com/users/patr1ckm/gists{/gist_id}","starred_url":"https://api.github.com/users/patr1ckm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patr1ckm/subscriptions","organizations_url":"https://api.github.com/users/patr1ckm/orgs","repos_url":"https://api.github.com/users/patr1ckm/repos","events_url":"https://api.github.com/users/patr1ckm/events{/privacy}","received_events_url":"https://api.github.com/users/patr1ckm/received_events","type":"User","site_admin":false},"repo":{"id":100615091,"name":"civis-r","full_name":"patr1ckm/civis-r","owner":{"login":"patr1ckm","id":427445,"avatar_url":"https://avatars3.githubusercontent.com/u/427445?v=4","gravatar_id":"","url":"https://api.github.com/users/patr1ckm","html_url":"https://github.com/patr1ckm","followers_url":"https://api.github.com/users/patr1ckm/followers","following_url":"https://api.github.com/users/patr1ckm/following{/other_user}","gists_url":"https://api.github.com/users/patr1ckm/gists{/gist_id}","starred_url":"https://api.github.com/users/patr1ckm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patr1ckm/subscriptions","organizations_url":"https://api.github.com/users/patr1ckm/orgs","repos_url":"https://api.github.com/users/patr1ckm/repos","events_url":"https://api.github.com/users/patr1ckm/events{/privacy}","received_events_url":"https://api.github.com/users/patr1ckm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/patr1ckm/civis-r","description":"Civis API Client for R: https://civisanalytics.com/products/civis-platform/","fork":true,"url":"https://api.github.com/repos/patr1ckm/civis-r","forks_url":"https://api.github.com/repos/patr1ckm/civis-r/forks","keys_url":"https://api.github.com/repos/patr1ckm/civis-r/keys{/key_id}","collaborators_url":"https://api.github.com/repos/patr1ckm/civis-r/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/patr1ckm/civis-r/teams","hooks_url":"https://api.github.com/repos/patr1ckm/civis-r/hooks","issue_events_url":"https://api.github.com/repos/patr1ckm/civis-r/issues/events{/number}","events_url":"https://api.github.com/repos/patr1ckm/civis-r/events","assignees_url":"https://api.github.com/repos/patr1ckm/civis-r/assignees{/user}","branches_url":"https://api.github.com/repos/patr1ckm/civis-r/branches{/branch}","tags_url":"https://api.github.com/repos/patr1ckm/civis-r/tags","blobs_url":"https://api.github.com/repos/patr1ckm/civis-r/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/patr1ckm/civis-r/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/patr1ckm/civis-r/git/refs{/sha}","trees_url":"https://api.github.com/repos/patr1ckm/civis-r/git/trees{/sha}","statuses_url":"https://api.github.com/repos/patr1ckm/civis-r/statuses/{sha}","languages_url":"https://api.github.com/repos/patr1ckm/civis-r/languages","stargazers_url":"https://api.github.com/repos/patr1ckm/civis-r/stargazers","contributors_url":"https://api.github.com/repos/patr1ckm/civis-r/contributors","subscribers_url":"https://api.github.com/repos/patr1ckm/civis-r/subscribers","subscription_url":"https://api.github.com/repos/patr1ckm/civis-r/subscription","commits_url":"https://api.github.com/repos/patr1ckm/civis-r/commits{/sha}","git_commits_url":"https://api.github.com/repos/patr1ckm/civis-r/git/commits{/sha}","comments_url":"https://api.github.com/repos/patr1ckm/civis-r/comments{/number}","issue_comment_url":"https://api.github.com/repos/patr1ckm/civis-r/issues/comments{/number}","contents_url":"https://api.github.com/repos/patr1ckm/civis-r/contents/{+path}","compare_url":"https://api.github.com/repos/patr1ckm/civis-r/compare/{base}...{head}","merges_url":"https://api.github.com/repos/patr1ckm/civis-r/merges","archive_url":"https://api.github.com/repos/patr1ckm/civis-r/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/patr1ckm/civis-r/downloads","issues_url":"https://api.github.com/repos/patr1ckm/civis-r/issues{/number}","pulls_url":"https://api.github.com/repos/patr1ckm/civis-r/pulls{/number}","milestones_url":"https://api.github.com/repos/patr1ckm/civis-r/milestones{/number}","notifications_url":"https://api.github.com/repos/patr1ckm/civis-r/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/patr1ckm/civis-r/labels{/name}","releases_url":"https://api.github.com/repos/patr1ckm/civis-r/releases{/id}","deployments_url":"https://api.github.com/repos/patr1ckm/civis-r/deployments","created_at":"2017-08-17T14:55:03Z","updated_at":"2017-08-17T14:55:05Z","pushed_at":"2018-03-01T15:54:35Z","git_url":"git://github.com/patr1ckm/civis-r.git","ssh_url":"git@github.com:patr1ckm/civis-r.git","clone_url":"https://github.com/patr1ckm/civis-r.git","svn_url":"https://github.com/patr1ckm/civis-r","homepage":"","size":2772,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"civisanalytics:master","ref":"master","sha":"6051529f15e7818fc89e42f22bb6fd43ad6ea81a","user":{"login":"civisanalytics","id":3299743,"avatar_url":"https://avatars3.githubusercontent.com/u/3299743?v=4","gravatar_id":"","url":"https://api.github.com/users/civisanalytics","html_url":"https://github.com/civisanalytics","followers_url":"https://api.github.com/users/civisanalytics/followers","following_url":"https://api.github.com/users/civisanalytics/following{/other_user}","gists_url":"https://api.github.com/users/civisanalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/civisanalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civisanalytics/subscriptions","organizations_url":"https://api.github.com/users/civisanalytics/orgs","repos_url":"https://api.github.com/users/civisanalytics/repos","events_url":"https://api.github.com/users/civisanalytics/events{/privacy}","received_events_url":"https://api.github.com/users/civisanalytics/received_events","type":"Organization","site_admin":false},"repo":{"id":99700009,"name":"civis-r","full_name":"civisanalytics/civis-r","owner":{"login":"civisanalytics","id":3299743,"avatar_url":"https://avatars3.githubusercontent.com/u/3299743?v=4","gravatar_id":"","url":"https://api.github.com/users/civisanalytics","html_url":"https://github.com/civisanalytics","followers_url":"https://api.github.com/users/civisanalytics/followers","following_url":"https://api.github.com/users/civisanalytics/following{/other_user}","gists_url":"https://api.github.com/users/civisanalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/civisanalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civisanalytics/subscriptions","organizations_url":"https://api.github.com/users/civisanalytics/orgs","repos_url":"https://api.github.com/users/civisanalytics/repos","events_url":"https://api.github.com/users/civisanalytics/events{/privacy}","received_events_url":"https://api.github.com/users/civisanalytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civisanalytics/civis-r","description":"Civis API Client for R: https://civisanalytics.com/products/civis-platform/","fork":false,"url":"https://api.github.com/repos/civisanalytics/civis-r","forks_url":"https://api.github.com/repos/civisanalytics/civis-r/forks","keys_url":"https://api.github.com/repos/civisanalytics/civis-r/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civisanalytics/civis-r/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civisanalytics/civis-r/teams","hooks_url":"https://api.github.com/repos/civisanalytics/civis-r/hooks","issue_events_url":"https://api.github.com/repos/civisanalytics/civis-r/issues/events{/number}","events_url":"https://api.github.com/repos/civisanalytics/civis-r/events","assignees_url":"https://api.github.com/repos/civisanalytics/civis-r/assignees{/user}","branches_url":"https://api.github.com/repos/civisanalytics/civis-r/branches{/branch}","tags_url":"https://api.github.com/repos/civisanalytics/civis-r/tags","blobs_url":"https://api.github.com/repos/civisanalytics/civis-r/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civisanalytics/civis-r/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civisanalytics/civis-r/git/refs{/sha}","trees_url":"https://api.github.com/repos/civisanalytics/civis-r/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civisanalytics/civis-r/statuses/{sha}","languages_url":"https://api.github.com/repos/civisanalytics/civis-r/languages","stargazers_url":"https://api.github.com/repos/civisanalytics/civis-r/stargazers","contributors_url":"https://api.github.com/repos/civisanalytics/civis-r/contributors","subscribers_url":"https://api.github.com/repos/civisanalytics/civis-r/subscribers","subscription_url":"https://api.github.com/repos/civisanalytics/civis-r/subscription","commits_url":"https://api.github.com/repos/civisanalytics/civis-r/commits{/sha}","git_commits_url":"https://api.github.com/repos/civisanalytics/civis-r/git/commits{/sha}","comments_url":"https://api.github.com/repos/civisanalytics/civis-r/comments{/number}","issue_comment_url":"https://api.github.com/repos/civisanalytics/civis-r/issues/comments{/number}","contents_url":"https://api.github.com/repos/civisanalytics/civis-r/contents/{+path}","compare_url":"https://api.github.com/repos/civisanalytics/civis-r/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civisanalytics/civis-r/merges","archive_url":"https://api.github.com/repos/civisanalytics/civis-r/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civisanalytics/civis-r/downloads","issues_url":"https://api.github.com/repos/civisanalytics/civis-r/issues{/number}","pulls_url":"https://api.github.com/repos/civisanalytics/civis-r/pulls{/number}","milestones_url":"https://api.github.com/repos/civisanalytics/civis-r/milestones{/number}","notifications_url":"https://api.github.com/repos/civisanalytics/civis-r/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civisanalytics/civis-r/labels{/name}","releases_url":"https://api.github.com/repos/civisanalytics/civis-r/releases{/id}","deployments_url":"https://api.github.com/repos/civisanalytics/civis-r/deployments","created_at":"2017-08-08T14:09:46Z","updated_at":"2017-11-22T13:32:58Z","pushed_at":"2018-03-01T15:54:36Z","git_url":"git://github.com/civisanalytics/civis-r.git","ssh_url":"git@github.com:civisanalytics/civis-r.git","clone_url":"https://github.com/civisanalytics/civis-r.git","svn_url":"https://github.com/civisanalytics/civis-r","homepage":"","size":2408,"stargazers_count":6,"watchers_count":6,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":5,"open_issues":3,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88"},"html":{"href":"https://github.com/civisanalytics/civis-r/pull/88"},"issue":{"href":"https://api.github.com/repos/civisanalytics/civis-r/issues/88"},"comments":{"href":"https://api.github.com/repos/civisanalytics/civis-r/issues/88/comments"},"review_comments":{"href":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88/comments"},"review_comment":{"href":"https://api.github.com/repos/civisanalytics/civis-r/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civisanalytics/civis-r/pulls/88/commits"},"statuses":{"href":"https://api.github.com/repos/civisanalytics/civis-r/statuses/d00926fbf2a587fbf88273fbdb079c08d6d814ea"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"patr1ckm"}}