| cloudos.query | R Documentation |
High-level function that orchestrates the full query lifecycle: submit -> poll status -> fetch results as dataframe.
cloudos.query(
profilename = "",
cohort_id = "",
sql = "",
poll_interval = 2,
max_wait = 600,
page_size = 1000,
all_pages = TRUE
)
profilename |
Character. Name of the configured profile to use. If empty or NULL, uses the default profile. |
cohort_id |
Character. ID of the cohort to query. |
sql |
Character. SQL query to execute. |
poll_interval |
Integer. Seconds between status checks (default: 2). |
max_wait |
Integer. Maximum seconds to wait for completion (default: 600). |
page_size |
Integer. Number of rows per page (default: 1000). |
all_pages |
Logical. Fetch all result pages automatically (default: TRUE). When TRUE, submits multiple async tasks (one per page) to fetch complete results. |
IMPORTANT: Pagination works by submitting separate tasks for each page. When all_pages=TRUE, this function submits multiple async tasks (one per page), waits for all to complete, and combines the results. This may take longer for large result sets.
Data frame with query results.
## Not run:
# Fetch all results
results <- cloudos.query(
profilename = "production",
cohort_id = "699edb4380a6867895f0c9e1",
sql = "SELECT person_id, gender_concept_id FROM person LIMIT 500"
)
# Fetch only first page
results_page1 <- cloudos.query(
profilename = "production",
cohort_id = "699edb4380a6867895f0c9e1",
sql = "SELECT person_id FROM person",
all_pages = FALSE,
page_size = 100
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.