YTsaurus 테이블 엔진

YTsaurus 테이블 엔진

YTsaurus 테이블 엔진을 사용하면 YTsaurus 클러스터에서 데이터를 가져올 수 있어요.

출처: 문서

본문

테이블 생성하기

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

이것은 실험적 기능으로, 향후 릴리스에서 이전 버전과 호환되지 않는 방식으로 변경될 수 있어요. YTsaurus 테이블 엔진 사용은 allow_experimental_ytsaurus_table_engine 설정으로 활성화해요. 다음과 같이 할 수 있어요. SET allow_experimental_ytsaurus_table_engine = 1.

엔진 매개변수

  • http_proxy_url — YTsaurus http 프록시의 URL
  • cypress_path — 데이터 소스의 Cypress 경로
  • oauth_token — OAuth 토큰

사용 예시

YTsaurus 테이블을 만드는 쿼리를 보여줘요:

Query

SHOW CREATE TABLE yt_saurus;

Response

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

테이블에서 데이터를 반환하려면 실행해요:

Query

SELECT * FROM yt_saurus;

Response

┌──a─┬─b──┐
│ 10 │ 20 │
└────┴────┘

데이터 타입

기본(Primitive) 데이터 타입

YTsaurus data type ClickHouse data type
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)

복합(Composite) 타입

YTsaurus data type ClickHouse data type
decimal Decimal
optional Nullable
list Array
struct NamedTuple
tuple Tuple
variant Variant
dict Array(Tuple(…))
tagged T

함께 보기

더 알아보기 (Learn more)