Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

YTsaurus 表引擎

Experimental 功能
ClickHouse Cloud 不支持此功能

YTsaurus 表引擎可让您从 YTsaurus 集群导入数据。

创建表

    CREATE TABLE [IF NOT EXISTS] [db.]table_name
    (
        name1 [type1],
        name2 [type2], ...
    ) ENGINE = YTsaurus('http_proxy_url', 'cypress_path', 'oauth_token')

引擎参数

  • http_proxy_url — YTsaurus HTTP 代理的 URL。
  • cypress_path — 数据源的 Cypress 路径。
  • oauth_token — OAuth 令牌。

用法示例

演示创建 YTsaurus 表的查询:

Querysql
SHOW CREATE TABLE yt_saurus;
Responsesql
CREATE TABLE yt_saurus
(
    `a` UInt32,
    `b` String
)
ENGINE = YTsaurus('http://localhost:8000', '//tmp/table', 'password')

要查询表中的数据,请运行:

Querysql
SELECT * FROM yt_saurus;
Responseresponse
┌──a─┬─b──┐
│ 10 │ 20 │
└────┴────┘

数据类型

基本数据类型

YTsaurus 数据类型 ClickHouse 数据类型
int8 Int8
int16 Int16
int32 Int32
int64 Int64
uint8 UInt8
uint16 UInt16
uint32 UInt32
uint64 UInt64
float Float32
double Float64
boolean Bool
string String
utf8 String
json JSON
yson(type_v3) JSON
uuid UUID
date32 Date (尚不支持)
datetime64 Int64
timestamp64 Int64
interval64 Int64
date Date (尚不支持)
datetime DateTime
timestamp DateTime64(6)
interval UInt64
any String
null Nothing
void Nothing
T with required = False Nullable(T)

复合类型

YTsaurus 数据类型 ClickHouse 数据类型
decimal Decimal
optional Nullable
list Array
struct NamedTuple
tuple Tuple
variant Variant
dict `Array(Tuple(…))
tagged T

另请参阅

Navigation