Dense and Sparse Cubes
By default, the /table
endpoint returns a "dense cube". That means that it returns every value, even if the value is null or 0.
If you are generating large table queries that are likely to contain lots of null or 0 values, you can instead access the /table/sparse
endpoint. This returns only non zero and non null values. Each returned value has an index associated with it, which you can use to identify where it belongs in the table.
The only difference between the two endpoints is the contents of the cubes
section in the response. They both accept identical input and return otherwise identical responses.
Example
Consider the following table, showing Gender by Marital Status:
As you can see, it contains a number of cells with 0 values.
To query the Open Data API for these values, you would use a request similar to the following:
{
"database": "str:database:bank",
"measures": [
"str:count:bank:F_Customer"
],
"dimensions": [
[
"str:field:bank:F_Customer:Gender"
],
[
"str:field:bank:F_Customer:Marital_Status"
]
]
}
Below are the examples of the cubes
section in the responses from the two endpoints:
CODE
|
CODE
|