View source: R/get_resource_sql.R
get_resource_sql | R Documentation |
Similar to get_resource()
but with more options for server-side querying of data.
However, this function has a lower maximum row number
(32,000 vs 99,999) for returned results.
get_resource_sql(sql)
sql |
(character) a single PostgreSQL SELECT query. Must include a resource ID, which must be double-quoted e.g.,
Column names must be double-quoted, while character values in filters must be single-quoted. e.g.,
You may need to escape quote marks with
|
a tibble with the query results. Only 32,000 rows can be returned from a single SQL query.
get_resource()
for downloading a resource without using a
SQL query.
sql <- "
SELECT
\"TotalCancelled\",\"TotalOperations\",\"Hospital\",\"Month\"
FROM
\"bcc860a4-49f4-4232-a76b-f559cf6eb885\"
WHERE
\"Hospital\" = 'D102H'
"
df <- get_resource_sql(sql)
# This is equivalent to:
cols <- c(
"TotalCancelled", "TotalOperations",
"Hospital", "Month"
)
row_filter <- c(Hospital = "D102H")
df2 <- get_resource(
"bcc860a4-49f4-4232-a76b-f559cf6eb885",
col_select = cols,
row_filters = row_filter
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.