Skip to contents

Retrieves data from an xMart table or view, and returns it as a tibble. For views, returns the entire data frame from the mart. For tables, can choose to return only data columns (the default), all columns, or only the system columns.

Usage

xmart4_table(
  mart,
  table,
  top = NULL,
  query = NULL,
  format = c("none", "csv", "streaming"),
  col_types = NULL,
  full_table = TRUE,
  xmart_server = c("UAT", "PROD"),
  return_cols = c("data", "all", "sysdata"),
  auth_type = "client",
  token = NULL
)

Arguments

mart

Name of the xMart4 mart

table

Name of a table within the mart, otherwise NULL (the default)

top

Number of rows of a table to return

query

A single string fitting the Odata protocol that must start with "$filter=".

format

Specification of the output format to be returned by the xMart API. Defaults to "none", but consider switching to "csv" if you are having loading an extremely large table. See the xMart4 API documentation for details on the three options.

col_types

One of NULL, a readr::cols() specification, or a string. This is passed to readr::type_convert(), so see documentation there for more details.

full_table

Logical, whether or not to load all the rows in a specified table, defaults to TRUE. If no format is provided, the xMart4 API limits calls to 100,000 rows at a time, so if full_table == TRUE, the function automatically repeats the API call to extract all rows within the xMart4 table. Ignored if format="streaming" or format="csv".

xmart_server

Either 'UAT' (the default) or 'PROD'

return_cols

Return data columns only (default), all columns, or system data columns. Only works on tables, as views have no system columns.

auth_type

Type of authorization to use for the token authorization. If "client" (the default), it uses an AzureAD client setup. The old "wims" method has been discontinued.

token

Access token for xMart4 server. If NULL (the default), the package automatically creates and manages access for the user if Azure client ID and secret set up properly. See vignette("token_setup") for instructions and details.

Value

A tibble.