Skip to main content
Version: Next

ChartDataQueryContextSchema

custom_cache_timeoutintegernullable

Override the default cache timeout

datasource object
id objectrequired

Datasource id/uuid

oneOf
integer
typestring

Datasource type

Possible values: [table, dataset, query, saved_query, view]

forcebooleannullable

Should the queries be forced to load from the source. Default: false

form_datanullable
queries object[]
  • Array [
  • annotation_layers object[]nullable

    Annotation layers to apply to chart

  • Array [
  • annotationTypestring

    Type of annotation layer

    Possible values: [FORMULA, INTERVAL, EVENT, TIME_SERIES]

    colorstringnullable

    Layer color

    descriptionColumnsstring[]

    Columns to use as the description. If none are provided, all will be shown.

    hideLinebooleannullable

    Should line be hidden. Only applies to line annotations

    intervalEndColumnstringnullable

    Column containing end of interval. Only applies to interval layers

    namestringrequired

    Name of layer

    opacitystringnullable

    Opacity of layer

    Possible values: [``, opacityLow, opacityMedium, opacityHigh]

    overrides objectnullable

    which properties should be overridable

    showbooleanrequired

    Should the layer be shown

    showLabelbooleannullable

    Should the label always be shown

    showMarkersbooleanrequired

    Should markers be shown. Only applies to line annotations.

    sourceTypestring

    Type of source for annotation data

    Possible values: [``, line, NATIVE, table]

    stylestring

    Line style. Only applies to time-series annotations

    Possible values: [dashed, dotted, solid, longDashed]

    timeColumnstringnullable

    Column with event date or interval start date

    titleColumnstringnullable

    Column with title

    valuerequired

    For formula annotations, this contains the formula. For other types, this is the primary key of the source object.

    widthnumber

    Width of annotation line

    Possible values: >= 0

  • ]
  • applied_time_extrasobjectnullable

    A mapping of temporal extras that have been applied to the query

    Example: {"__time_range":"1 year ago : now"}
    apply_fetch_values_predicatebooleannullable

    Add fetch values predicate (where clause) to query if defined in datasource

    columnsundefined[]nullable

    Columns which to select in the query.

    datasource objectnullable
    id objectrequired

    Datasource id/uuid

    oneOf
    integer
    typestring

    Datasource type

    Possible values: [table, dataset, query, saved_query, view]

    extras objectnullable

    Extra parameters to add to the query.

    havingstring

    HAVING clause to be added to aggregate queries using AND operator.

    instant_time_comparison_rangestringnullable

    This is only set using the new time comparison controls that is made available in some plugins behind the experimental feature flag.

    relative_endstring

    End time for relative time deltas. Default: config["DEFAULT_RELATIVE_START_TIME"]

    Possible values: [today, now]

    relative_startstring

    Start time for relative time deltas. Default: config["DEFAULT_RELATIVE_START_TIME"]

    Possible values: [today, now]

    time_grain_sqlastringnullable

    To what level of granularity should the temporal column be aggregated. Supports ISO 8601 durations.

    Possible values: [PT1S, PT5S, PT30S, PT1M, PT5M, PT10M, PT15M, PT30M, PT1H, PT6H, P1D, P1W, P1M, P3M, P1Y, 1969-12-28T00:00:00Z/P1W, 1969-12-29T00:00:00Z/P1W, P1W/1970-01-03T00:00:00Z, P1W/1970-01-04T00:00:00Z]

    Example: P1D
    wherestring

    WHERE clause to be added to queries using AND operator.

    filters object[]nullable
  • Array [
  • colrequired

    The column to filter by. Can be either a string (physical or saved expression) or an object (adhoc column)

    Example: country
    grainstring

    Optional time grain for temporal filters

    Example: PT1M
    isExtraboolean

    Indicates if the filter has been added by a filter component as opposed to being a part of the original query.

    opstringrequired

    The comparison operator.

    Possible values: [==, !=, >, <, >=, <=, LIKE, NOT LIKE, ILIKE, IS NULL, IS NOT NULL, IN, NOT IN, IS TRUE, IS FALSE, TEMPORAL_RANGE]

    Example: IN
    valnullable

    The value or values to compare against. Can be a string, integer, decimal, None or list, depending on the operator.

    Example: ["China","France","Japan"]
  • ]
  • granularitystringnullable

    Name of temporal column used for time filtering.

    granularity_sqlastringnullabledeprecated

    Name of temporal column used for time filtering for SQL datasources. This field is deprecated, use granularity instead.

    groupbyundefined[]nullable

    Columns by which to group the query. This field is deprecated, use columns instead.

    havingstringnullabledeprecated

    HAVING clause to be added to aggregate queries using AND operator. This field is deprecated and should be passed to extras.

    is_rowcountbooleannullable

    Should the rowcount of the actual query be returned

    is_timeseriesbooleannullable

    Is the query_object a timeseries.

    metricsundefined[]nullable

    Aggregate expressions. Metrics can be passed as both references to datasource metrics (strings), or ad-hoc metricswhich are defined only within the query object. See ChartDataAdhocMetricSchema for the structure of ad-hoc metrics.

    order_descbooleannullable

    Reverse order. Default: false

    orderbyundefined[]nullable

    Expects a list of lists where the first element is the column name which to sort by, and the second element is a boolean.

    Example: [["my_col_1",false],["my_col_2",true]]
    post_processing object[]nullable

    Post processing operations to be applied to the result set. Operations are applied to the result set in sequential order.

  • Array [
  • operationstringrequired

    Post processing operation type

    Possible values: [aggregate, boxplot, compare, contribution, cum, diff, escape_separator, flatten, geodetic_parse, geohash_decode, geohash_encode, histogram, pivot, prophet, rank, rename, resample, rolling, select, sort, unescape_separator]

    Example: aggregate
    optionsobject

    Options specifying how to perform the operation. Please refer to the respective post processing operation option schemas. For example, ChartDataPostProcessingOperationOptions specifies the required options for the pivot operation.

    Example: {"aggregates":{"age_mean":{"column":"age","operator":"mean"},"age_q1":{"column":"age","operator":"percentile","options":{"q":0.25}}},"groupby":["country","gender"]}
  • ]
  • result_typenullable

    Possible values: [columns, full, query, results, samples, timegrains, post_processed, drill_detail]

    row_limitintegernullable

    Maximum row count (0=disabled). Default: config["ROW_LIMIT"]

    Possible values: >= 0

    row_offsetintegernullable

    Number of rows to skip. Default: 0

    Possible values: >= 0

    series_columnsundefined[]nullable

    Columns to use when limiting series count. All columns must be present in the columns property. Requires series_limit and series_limit_metric to be set.

    series_limitintegernullable

    Maximum number of series. Requires series and series_limit_metric to be set.

    series_limit_metricnullable

    Metric used to limit timeseries queries by. Requires series and series_limit to be set.

    time_offsetsstring[]nullable
    time_rangestringnullable

    A time rage, either expressed as a colon separated string since : until or human readable freeform. Valid formats for since and until are:

    • ISO 8601
    • X days/years/hours/day/year/weeks
    • X days/years/hours/day/year/weeks ago
    • X days/years/hours/day/year/weeks from now

    Additionally, the following freeform can be used:

    • Last day
    • Last week
    • Last month
    • Last quarter
    • Last year
    • No filter
    • Last X seconds/minutes/hours/days/weeks/months/years
    • Next X seconds/minutes/hours/days/weeks/months/years
    Example: Last week
    time_shiftstringnullable

    A human-readable date/time string. Please refer to parsdatetime documentation for details on valid values.

    timeseries_limitintegernullable

    Maximum row count for timeseries queries. This field is deprecated, use series_limit instead.Default: 0

    timeseries_limit_metricnullable

    Metric used to limit timeseries queries by. This field is deprecated, use series_limit_metric instead.

    url_params objectnullable

    Optional query parameters passed to a dashboard or Explore view

    property name*string

    The value of the query parameter

    wherestringnullabledeprecated

    WHERE clause to be added to queries using AND operator.This field is deprecated and should be passed to extras.

  • ]
  • result_format

    Possible values: [csv, json, xlsx]

    result_type

    Possible values: [columns, full, query, results, samples, timegrains, post_processed, drill_detail]

    ChartDataQueryContextSchema
    {
    "custom_cache_timeout": 0,
    "datasource": {
    "id": 0,
    "type": "table"
    },
    "force": true,
    "queries": [
    {
    "annotation_layers": [
    {
    "annotationType": "FORMULA",
    "color": "string",
    "descriptionColumns": [
    "string"
    ],
    "hideLine": true,
    "intervalEndColumn": "string",
    "name": "string",
    "opacity": "",
    "overrides": {},
    "show": true,
    "showLabel": true,
    "showMarkers": true,
    "sourceType": "",
    "style": "dashed",
    "timeColumn": "string",
    "titleColumn": "string",
    "width": 0
    }
    ],
    "applied_time_extras": {
    "__time_range": "1 year ago : now"
    },
    "apply_fetch_values_predicate": true,
    "columns": [
    null
    ],
    "datasource": {
    "id": 0,
    "type": "table"
    },
    "extras": {
    "having": "string",
    "instant_time_comparison_range": "string",
    "relative_end": "today",
    "relative_start": "today",
    "time_grain_sqla": "P1D",
    "where": "string"
    },
    "filters": [
    {
    "col": "country",
    "grain": "PT1M",
    "isExtra": true,
    "op": "IN",
    "val": [
    "China",
    "France",
    "Japan"
    ]
    }
    ],
    "granularity": "string",
    "groupby": [
    null
    ],
    "is_rowcount": true,
    "is_timeseries": true,
    "metrics": [
    null
    ],
    "order_desc": true,
    "orderby": [
    [
    "my_col_1",
    false
    ],
    [
    "my_col_2",
    true
    ]
    ],
    "post_processing": [
    {
    "operation": "aggregate",
    "options": {
    "aggregates": {
    "age_mean": {
    "column": "age",
    "operator": "mean"
    },
    "age_q1": {
    "column": "age",
    "operator": "percentile",
    "options": {
    "q": 0.25
    }
    }
    },
    "groupby": [
    "country",
    "gender"
    ]
    }
    }
    ],
    "row_limit": 0,
    "row_offset": 0,
    "series_columns": [
    null
    ],
    "series_limit": 0,
    "time_offsets": [
    "string"
    ],
    "time_range": "Last week",
    "time_shift": "string",
    "timeseries_limit": 0,
    "url_params": {}
    }
    ]
    }