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テーブルを作成するクエリの例を示します。
SHOW CREATE TABLE yt_saurus;CREATE TABLE yt_saurus
(
`a` UInt32,
`b` String
)
ENGINE = YTsaurus('http://localhost:8000', '//tmp/table', 'password')テーブルからデータを取得するには、次を実行します。
SELECT * FROM yt_saurus;┌──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 |
関連項目