get_query_from_token: Get Query From Token

View source: R/get_query_from_token.R

get_query_from_tokenR Documentation

Get Query From Token

Description

Uses Flipside ShroomDK to access a Query Token (Run ID). This function is for pagination and multiple requests. It is best suited for debugging and testing new queries. Consider 'auto_paginate_query()' for queries already known to work as expected. Note: To reduce payload it returns a list of outputs (separating column names from rows). See 'clean_query()' for converting result to a data frame.

Usage

get_query_from_token(
  query_run_id,
  api_key,
  page_number = 1,
  page_size = 1000,
  result_format = "csv",
  api_url = "https://api-v2.flipsidecrypto.xyz/json-rpc"
)

Arguments

query_run_id

queryRunId from 'create_query_token()', for token stored as 'x', use 'x$result$queryRequest$queryRunId'

api_key

Flipside Crypto ShroomDK API Key

page_number

Results are cached, max 30MB of data per page.

page_size

Default 1000. Paginate via page_number. May return error if page_size causes data to exceed 30MB.

result_format

Default to csv. Options: csv and json.

api_url

default to https://api-v2.flipsidecrypto.xyz/json-rpc but upgradeable for user.

Value

returns a list of jsonrpc, id, and result. Within result are: columnNames, columnTypes, rows, page, sql, format, originalQueryRun, redirectedToQueryRun use 'clean_query()' to transform this into a data frame.

Examples

## Not run: 
query <- create_query_token("SELECT * FROM ETHEREUM.CORE.FACT_TRANSACTIONS LIMIT 1000", api_key)
fact_transactions <- get_query_from_token(query$result$queryRequest$queryRunId, api_key, 1, 1000)

## End(Not run)

shroomDK documentation built on May 29, 2024, 1:21 a.m.