The reference ClickHouse database can be used to get started using DirectQuery quickly. Here we will go over how to get started using DirectQuery against the included reference ClickHouse database in a local environment. This section will go over how to start the ClickHouse Database locally as well as the configurations needed to connect to the Database. For an overview of DirectQuery, please see the DirectQuery Overview section in the User Guide.Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
Reference ClickHouse Implementation Overview
comes with a reference ClickHouse Database packaged within a Docker Container that can be run locally by using Docker.File Structure
The following files can be found within thefrtb-directquery module under src/test/resources/database/clickhouse/:
- clickhouse_docker_container/
- input_data
- run_scripts
- Dockerfile
- init-db.sh
clickhouse_docker_container
This directory contains the entire ClickHouse Docker database along with everything needed to get the ClickHouse database up and running.run_scripts
Scripts that can be used to build, run and stop the Docker Container. This includes scripts that can be run on Windows or Linux machines. Alternatively you can run the Docker commands directly as outlined in the Running the Project section.input_data
‘s reference data has been converted into a format that can be loaded directly into ClickHouse. This dataset contains all data for the Tables that DirectQuery requires.Dockerfile
This file is where the Docker Image runs. As a prerequisite, you must have Docker running locally (you can use Docker Desktop). This file performs the following actions:- Create an empty ClickHouse database in the Docker Container
- Copy the database initialization script init-bd.sh into the Docker Container
- Create and copy the input CSV files from input_data/ into the Docker Container
init-db.sh
This file contains the DDL of the Database. It creates all the Tables required by DirectQuery. This file creates a Database namedFRTB as well as a Database Schema named FRTB.
Running the project
To run connected to the reference ClickHouse implementation will need to:- Build the ClickHouse Docker Container
- Start the ClickHouse Docker Container
- Start the Project with DirectQuery enabled and configured for ClickHouse.
1. Build Docker Image
First you will need to build the Docker Image either through the command line, or by running the1_build script.
Script
Script can be run by double-clicking or through the command line:Command Line
You can build the Docker Image by running the following command from within theclickhouse_docker_container folder:
frtb-clickhouse-image.
2. Start ClickHouse Database
Now you can run the ClickHouse Database either through the command line or by running the2_run script. You can verify the database is up by going to the URL ‘localhost:8123/play’.
Script
Script can be run by double-clicking or through the command line:Command Line
You can start the Docker Container, for your built Docker Image, by running the following command from within theclickhouse_docker_container folder:
frtb-clickhouse-image in a Docker Container named frtb-clickhouse-container on port 8123.
3. Start with ClickHouse enabled
You are now ready to start the with DirectQuery enabled and configured for ClickHouse.Property Configuration
Some properties will need to be configured when starting .application.yaml
Use the following properties in theapplication.yaml file to connect to the ClickHouse Database:
4. Shutdown ClickHouse Database
When we are finished with the ClickHouse Database, we can shut down the Docker Container either through the command line or by running the3_kill script.
Script
Script can be run by double-clicking or through the command line:Command Line
You can stop the Docker Container by running the following command:frtb-clickhouse-container and frees the port 8123.