skip to Main Content

I installed the clickhouse program in the ubuntu operating system and connected the SQLyog program. I can create a database, but I cannot create a table in it. It gives the following CODE:119 error.

ubuntu 🙂 create table taxonomy_object_firewalls

CREATE TABLE taxonomy_object_firewalls

Query id: 37520dd5-44b9-436f-a5b6-96002f0a4ce7

0 rows in set. Elapsed: 0.001 sec.

Received exception from server (version 22.2.2):
Code: 119. DB::Exception: Received from localhost:9000. DB::Exception: Table engine is not specified in CREATE query. (ENGINE_REQUIRED)

2

Answers


  1. Check out the "Getting Started" guide in the docs. ClickHouse is unique in that every table has an Engine. Table engines determine where and how the data is stored. When in doubt, use MergeTree:

    CREATE DATABASE IF NOT EXISTS helloworld;
    
    CREATE TABLE helloworld.my_first_table
    (
        user_id UInt32,
        message String,
        timestamp DateTime,
        metric Float32
    )
    ENGINE = MergeTree()
    PRIMARY KEY (user_id, timestamp)
    

    Also, make sure you read about the primary key and how it works in ClickHouse. Primary keys are not typically unique, but instead determine the sort order.

    Login or Signup to reply.
  2. Noting that Rich’s syntax had a small unnecessary () after the ENGINE definition but was still successfully created in my testing. This syntax would be more accurate to the documentation:

    CREATE DATABASE IF NOT EXISTS helloworld;
    
    CREATE TABLE helloworld.my_first_table
    (
        user_id UInt32,
        message String,
        timestamp DateTime,
        metric Float32
    )
    ENGINE = MergeTree
    PRIMARY KEY (user_id, timestamp);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search