ClickHouse在Ubuntu中创建表格时出现错误。

huangapple go评论71阅读模式
英文:

clickhouse table creation error in ubuntu

问题

我在Ubuntu操作系统中安装了ClickHouse程序,并连接了SQLyog程序。我可以创建数据库,但无法在其中创建表格。它出现了以下错误代码:119。

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)
英文:

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 ClickHouse在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)

答案1

得分: 0

请查看文档中的“入门指南”。ClickHouse 独特之处在于每个表都有一个“引擎”。表引擎决定了数据的存储位置和方式。如果不确定,可以使用“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)

另外,请确保阅读有关主键及其在 ClickHouse 中的工作原理的信息。主键通常不是唯一的,而是确定排序顺序。

查看入门指南

英文:

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.

答案2

得分: 0

注意到Rich的语法在ENGINE定义之后有一个不必要的小括号(),但在我的测试中仍然成功创建了。这个语法更符合文档要求:

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);
英文:

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);

huangapple
  • 本文由 发表于 2023年2月19日 21:14:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75500385.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定