00 Set up your retail environment
Separate credentials, owned services, and readiness make data failures diagnosable.
Outcome
Create your dedicated ClickHouse Cloud service, managed Postgres instance, and operational CDC pipeline. Confirm access to ClickHouse Agents. Your laptop runs the sales generator and pricing workbench.
Analytics workshop with a prepared model
A production team can use ClickHouse transaction history and features such as price, promotions, availability, calendars, and weather to train a demand or revenue model. This workshop supplies a prepared model and synthetic sales; production model training is outside its scope. You will learn the data pipeline, SQL calculations, and how approved prices lead to generated transactions and observed analytics.
Starting point
Use your own ClickHouse Cloud account and a terminal for your platform.
Why
Separate credentials, owned services, and readiness make data failures diagnosable.
Cloud architecture
Historical Parquet files load from S3. The sales generator sends batched transaction lines directly to ClickHouse. Managed Postgres stores inventory, prices, policies, run metadata, batch acknowledgements, and approval receipts. ClickPipes replicates those operational records into ClickHouse.
SQL queries combine sales and operational state to discover pricing opportunities. ClickHouse Agents uses the same analytical views to recommend a strategy. You approve a price in the workbench; subsequent synthetic sales use it. ClickStack traces that application.
Actions
Choose your platform in the page header. Complete installation and account access before the session; the 25-minute module connects and verifies the stack.
Use macOS Terminal. Install Docker Desktop, Git, Python 3.12, and Node 22. Install the pinned ClickHouse CLI in your user directory:
npm install --global --prefix "$HOME/.local" clickhousectl@0.4.2
export PATH="$HOME/.local/bin:$PATH"Add the export PATH line to ~/.zshrc so new terminals find the tool. Verify:
docker version
docker compose version
git --version
python3.12 --version
node --version
clickhousectl --version-
Clone the workshop repository and install the lab dependencies:
git clone https://github.com/ClickHouse/ClickHouse_Demos.git cd ClickHouse_Demos cd "$(git rev-parse --show-toplevel)/workshops/dynamic_pricing" python3.12 -m venv .venv .venv/bin/python -m pip install -r versions.lock -e app/backend cp app/.env.workshop.example app/.env.workshop chmod 600 app/.env.workshop -
Create an API key for your own organization to authenticate Cloud mutations. In the ClickHouse Cloud console, open the organization menu and select API keys.

Select New API key. Name the key
dynamic_pricing, select the Admin role required to create the workshop resources, then select Generate API key. Save the generated key and secret privately.
OAuth is read-only. Run this login command separately, substituting your private credentials; keep them out of shared terminals and shell history:
clickhousectl cloud auth login --api-key '<YOUR_API_KEY>' --api-secret '<YOUR_API_SECRET>'The CLI stores credentials in
.clickhouse/credentials.json, which is ignored by Git. -
Edit the private file if you need to change the region or Postgres size. The template already selects Singapore and the prepared workshop model. Leave the ClickHouse hostname and both Postgres connection strings empty. Setup creates the managed services and fills in their Cloud endpoints. It also generates a stable installation ID and session secret. Setup detects your Cloud organization and public IPv4 address; if your API key can access several organizations, select one when prompted. Verify your CLI account:
clickhousectl cloud auth status clickhousectl cloud org listCreate your owned services:
bash scripts/setup-cloud.shThis single command creates your ClickHouse Cloud service with one replica,
pricingand telemetry databases, managed Postgres source schema, application and replication roles, publication, and six-table operational CDC ClickPipe. Progress messages show resource creation and readiness while setup waits for the destination schema and creates canonical views. Repeated setup preserves existing scenario state and reuses saved resource IDs.The three Cloud resources appear in
infra/resources.json. The files in the diagram's lower row stay on your laptop. You load historical data and build aggregates in Modules 01 and 02.To start over, stop the local workbench if it is running, then preview the workshop resources to delete:
bash scripts/setup-cloud.sh --destroyReview the listed IDs. The following command permanently deletes your workshop ClickPipe, Managed Postgres instance, and ClickHouse service, including their data:
bash scripts/setup-cloud.sh --destroy --executeAfter deletion completes, create a fresh stack with one replica:
bash scripts/setup-cloud.shSetup archives the deleted resource inventory and replaces the old connection settings. Your CLI login and workshop preferences remain available. Repeat Module 01 to reload historical data and Module 02 to rebuild aggregates and start sales.
-
Inspect
infra/resources.json: organization, region, service ID, Postgres ID, and ClickPipe ID. The inventory stores IDs; preflight checks readiness. KeepPRICING_POSTGRES_ADMIN_DSNfor schema initialization and grants. Setup savesPRICING_POSTGRES_DSNwith the limitedpricing_approle and privately stores the generated replication password. No manual role creation, URI editing, or pipe-ID editing is required. Module 02 checks operational CDC beside the direct sales stream. -
Verify the private Cloud hostname is bare, the SQL port is 8443 with TLS, and managed Postgres uses
sslmode=verify-fullplus its instance CA. No local Postgres or ClickHouse substitutes for this path.
Do not start the app until Module 01 has loaded history. The app's liveness endpoint and data readiness answer different questions.
6. Check managed agent access
In ClickHouse Cloud, select ClickHouse Agents, then Launch. Confirm you can open the managed chat and agent builder. You will create Retail Pricing Strategist in Module 05. Choose its model in the managed UI; no separate model API key is required in the local environment.
Verify
The setup command reports ready. Your inventory contains the ClickHouse service, Postgres instance, and ClickPipe IDs.
Reset
Keep your saved inventory for the remaining modules. Delete your services in Module 06.
Stretch
Explain liveness versus module readiness before starting the app.