I have a PostgreSQL database testdb (hosted on 10.55.55.55) as my data source, where I have read-only access. I also have another PostgreSQL database cubejs running on the same server where Cube.js is deployed. Both Cube.js and the DB cubejs are running in Docker.
My .env file contains:
CUBEJS_API_SECRET=secretkey123
CUBEJS_DB_TYPE=postgres
CUBEJS_DB_HOST=10.55.55.55
CUBEJS_DB_PORT=5432
CUBEJS_DB_NAME=testdb
CUBEJS_DB_USER=user_reader
CUBEJS_DB_PASS=password123
CUBEJS_DB_AGGREGATIONS_HOST=postgres
CUBEJS_DB_AGGREGATIONS_PORT=5432
CUBEJS_DB_AGGREGATIONS_NAME=cubejs
CUBEJS_DB_AGGREGATIONS_USER=cubejs_user
CUBEJS_DB_AGGREGATIONS_PASS=cubejs_password123
CUBEJS_PRE_AGGREGATIONS_SCHEMA=cube_preaggs
CUBEJS_DEV_MODE=true
CUBEJS_EXTERNAL_DEFAULT=true
I'm making the following POST request:
curl -X POST http://localhost:4000/cubejs-api/v1/load \
-H "Content-Type: application/json" \
-H "Authorization: secretkey123" \
--data '{
"query": {
"measures": [],
"dimensions": [
"customers.name",
"customers.email"
],
"timeDimensions": [
{
"dimension": "customers.created_at",
"granularity": "day"
}
],
"limit": 10
}
}'
The request returns the expected results, but the cube_preaggs schema is not created in the cubejs database (I've created the cube_preaggs schema beforehand, but the table for storing the sql-query still doesn’t appear).
How can I ensure that pre-aggregations are stored in the cubejs database? (In the future, we plan to use ClickHouse for pre-aggregations.) I see in the logs that the SQL query for pre-aggregation is executed in cube_preaggs without errors. Did I specify the database correctly in the .env file? What should I check?
I’d appreciate any insights, thanks in advance!