Documentation
Playground

Playground

Playground is a web-based tool that helps validate the data model by executing queries and previewing their results. It is supposed to be used by data engineers and developers while building the data model. If you'd like to let end users query the data, connect a BI tool or use the JavaScript SDKs to build your own query builder.

Playground is available in Cube Cloud on all product tiers (opens in a new tab).

Playground is available in Cube Core at localhost:4000 (opens in a new tab) when it's run in the development mode.

You can view the data model entities or search for them, compose a query from scratch or paste an exsiting query, view results, check a generated query, or copy equivalent queries for data APIs.

Viewing the data model

You can see a list of all cubes or views in the sidebar on the left. Choose either Cubes or Views to switch between cubes and views and click on a cube or a view to view a list of its members.

Measures, dimensions, and segments are shown using distinct colors. If a member has a title or a description set in the data model, they will be shown in a tooltip. If a member is not public, you will see a lock sign next to it.

Even if a cube, a view, or their member is not public, Playground would still allow you to query and validate it.

Switching the security context

You can click on the Security Context button in the top right corner to change the security context. Changing the security context can affect the contents of the sidebar that you see:

Searching the data model

You can search for cubes, views, and their members using the search bar in the sidebar on the left. Click on the element in the search results to add it to a new or existing query.

Composing queries

You can compose a new query by selecting desired measures, dimensions, and segments in the sidebar on the left. Click on the funnel icon next to any member to add a filter for it to the query.

Click All members or Used members to show only members of the query or all available members. Click Reset to remove all members from the query.

Use the Order drop-down on the right to specify how the results shall be sorted.

Use the Options drop-down on the right to specify if the query shall be ungrouped, to set a time zone, or to set a row limit and an offset.

Pasting a query

You can also compose a new query by clicking on the pencil button in the sidebar on the left and pasting a REST API query or a GraphQL API query from the clipboard and clicking Apply.

Pasting a SQL API query is not supported.

Using query tabs

You can use query tabs to keep results of previous queries while still being able to make new queries. Previous queries are kept in the local storage in your browser and will be restored when you open Playground once again.

You can also double-click on a query tab to give it a meaningful name.

Viewing results

Click Run Query on the top to run (or re-run) the query and check the querying time in the top right corner. Click on the querying time to open Rollup Designer that would help you create a pre-aggregation to accelerate the query.

View query results on the Results tab. Check the number of rows in the result set on the bottom and use the pagination control in the bottom right corner, if needed.

Expand the Chart pane to visualize the results. Choose one of visualization types and pivot data via the Pivot drop-down, if needed. Click Code to generate front-end code in Chart Prototyping.

Viewing a generated query

View the SQL query that Cube did (or will) run against the data source to get the results on the Generated SQL tab. Click Copy to put it into your clipboard.

Note that a generated query can contain placeholders, e.g., ? or $1, for parameters that Cube passes to an underlying data source driver later when executing the query.

Copying API queries

View the queries for respective data APIs on the SQL API, REST API, and GraphQL API tabs. Click Copy to put one of them into your clipboard.