Playground is a web-based tool which allows executing queries and previewing their results.

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

Cube Core and Cube Cloud both provide the Playground experience; however, a few additional features are available in Cube Cloud.

Playground Query and Results Example

Running Playground

Cube Core

Playground is available at http://localhost:4000 (opens in a new tab) when Cube is run in development mode, i.e., when CUBEJS_DEV_MODE is set to true.

Since Playground exposes all data models and allows running all possible queries, it should not be used in production. You can use the JavaScript SDKs to build your own query builder and use it to query your Cube API in a secure way.

Cube Cloud

Playground is available out of the box to authenticated Cube Cloud (opens in a new tab) users.

When editing the data model through the data model editor, Playground will switch to the Development API and its status will be visible in Playground:

Playground during API restart

Query tabs

You can use query tabs to keep results of previous queries while still being able to make new queries. The query tabs can be found at the top of the Developer Playground:

Cube Developer Playground Tabs

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

Editing the Security Context

The security context used for queries can be modified by clicking Add Security Context:

You can paste in an existing JWT if desired; or create a brand-new one by providing a JSON object that represents the decoded JWT.

Executing generated SQL

To see the SQL generated by a query, click Generated SQL:

If you're using Cube Cloud, you can copy this SQL and run it in your data source using the SQL Runner.

Using the Rollup Designer

The Rollup Designer provides an easy way to create and edit pre-aggregations from within the Playground. For example, when you execute a query that has no matching pre-aggregations, the Playground also displays some information above the results:

Clicking Query was not accelerated with pre-aggregation will open the Rollup Designer with a suggested pre-aggregation that will accelerate the query:

If desired, you can also modify settings such as the refresh key, the partition granularity, and indexes to further optimize the pre-aggregation by clicking the ​Settings tab:

Click Add to the Data Schema to add the pre-aggregation to the data model. You can then run the query again to see the results: