/clickhouse-spring-data-demo

Demo project for my article: Working With ClickHouse From Spring Data Using MySql Driver

Primary LanguageKotlinMIT LicenseMIT

clickhouse-spring-data-demo

build

Demo project for my article: Working With ClickHouse From Spring Data Using MySql Driver

Run Clickhouse

  1. Open the docker folder: cd docker
  2. Run Clickhouse: docker-compose up -d
  3. Create tables:
    docker-compose run clickhouse-client --host clickhouse-server --user admin --password admin --multiquery < ../sql/script.sql
  4. Login to DB using clickhouse client:
    docker-compose run clickhouse-client --host clickhouse-server --user admin --password admin

Run the service

./gradlew bootRun

Note: Java 11 or later has to be installed to run the demo project.

Send a request to the service

  • Create an item
    curl --header "Content-Type: application/json" \
       --request POST \
       --data '{ "itemId": "12323", "timestamp": "2009-09-22T16:47:08.432", "data": "123","list": {"list": ["1", "2", "3"]}}' \
       localhost:8080/v1/demo/item
  • List items
    curl localhost:8080/v1/demo/item