From 63c7e785607ffa5d00a066c9f1ed31c696c15b11 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Thu, 26 Sep 2024 17:43:42 +0100 Subject: [PATCH] Add a check and warning for large queries --- R/get_resource_sql.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/get_resource_sql.R b/R/get_resource_sql.R index 7c10d92..79c76bf 100644 --- a/R/get_resource_sql.R +++ b/R/get_resource_sql.R @@ -84,6 +84,13 @@ get_resource_sql <- function(sql) { # attempt get request content <- phs_GET("datastore_search_sql", query) + if (!is.null(content[["result"]][["records_truncated"]])) { + cli::cli_warn( + "The data was truncated because your query matched more than the + maximum number of rows." + ) + } + # get correct order of columns order <- purrr::map_chr( content$result$fields,