Query data
In this step, you will learn how to query your data using the data models you created in the previous step. Cube Cloud provides several ways to query your data, and we'll go over them here.
The Developer Playground is a web-based tool that allows you to query your data without connecting any tools or writing any code. It's a fastest way to explore your data.
Navigate to the
page in Cube Cloud:Next, you will select the measures and dimensions you want to query, and then
run the query. Let's do this for the orders
cube you generated in the previous
step.
Click orders.count
, then click :
Next, click orders.status
, and then click again:
Please feel free to experiment: select other measures or dimensions, pick a granularity for the time dimension instead of
, or choose another chart type instead of .From the deployment's Overview page, you can copy the GraphQL API URL for the deployment:
To see an example of how to query the GraphQL API using curl
, click :
To see an example of how to query the REST API using curl
, click :
First, navigate to the
page and enable the SQL API.Then, on the
page, click , which will open instructions on connecting different tools to the SQL API. You should see a screen with your connection credentials:We can test it by running the provided psql
command:
PGPASSWORD=c9fba08a9b41f69f698b00134587d325 \
psql -h fierce-bear.sql.aws-eu-central-1.cubecloudapp.dev \
-p 5432 \
-U cube fierce-bear
psql (14.5, server 14.2 (Cube SQL))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
fierce-bear=> SELECT COUNT(*) FROM orders;
COUNT(UInt8(1))
-----------------
10000
(1 row)
Since the SQL API is Postgres-compatible, please make sure to select connecting from BI tools.
as the database type whenNow that we've seen how to use Cube's APIs, let's take a look at how to add pre-aggregations to speed up your queries.
Did you find this page useful?