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 connect a BI tool or use the JavaScript SDKs to build your own query builder and use it to query your Cube in a secure way.

You can use this Playground to view and generate data model files.

Data model generator currently has the following limitations:

  • Even if multiple data sources are configured, it will only show the tables from in default data source. As a workaround, you can configure the second data source as default, generate data model files for it, then change the default data source back.
  • With each generation, files in the data model folder will be rewritten. If you'd like to combine files from multiple generations, please back them up manually.

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.

Accelerating queries

When you execute a query that has no matching pre-aggregations, you would see this notificaton. Clicking on it will open Rollup Designer that would help you create a pre-aggregation to accelerate the query: