メインコンテンツへスキップ
メインコンテンツへスキップ

TSKV

入力出力別名

説明

TabSeparated フォーマットと似ていますが、値を name=value 形式で出力します。 名前は TabSeparated フォーマットの場合と同じ方法でエスケープされ、= 記号も同様にエスケープされます。

SearchPhrase=   count()=8267016
SearchPhrase=バスルームインテリアデザイン    count()=2166
SearchPhrase=clickhouse     count()=1655
SearchPhrase=2014年春ファッション    count()=1549
SearchPhrase=フリーフォーム写真       count()=1480
SearchPhrase=アンジェリーナ・ジョリー    count()=1245
SearchPhrase=オムスク       count()=1112
SearchPhrase=犬種の写真    count()=1091
SearchPhrase=カーテンデザイン        count()=1064
SearchPhrase=バクー       count()=1000
SELECT * FROM t_null FORMAT TSKV
x=1    y=\N
注記

小さなカラムが多数ある場合、このフォーマットは非効率であり、通常これを使用する理由はありません。 とはいえ、効率の面では JSONEachRow フォーマットと同等です。

パース時には、異なるカラムの値の順序は任意で構いません。 一部の値を省略しても許容され、省略された値はデフォルト値と等しいものとして扱われます。 この場合、ゼロおよび空行がデフォルト値として使用されます。 テーブルで指定可能な複雑な値は、デフォルト値としてはサポートされません。

パース時には、追加のフィールド tskv をイコール記号や値なしで追加しても構いません。このフィールドは無視されます。

インポート時、input_format_skip_unknown_fields 設定が 1 に設定されている場合、名前が不明なカラムはスキップされます。

NULL\N としてフォーマットされます。

利用例

データの挿入

次の tskv ファイル football.tskv を使用します。

date=2022-04-30 season=2021     home_team=Sutton United away_team=Bradford City home_team_goals=1       away_team_goals=4
date=2022-04-30 season=2021     home_team=Swindon Town  away_team=Barrow        home_team_goals=2       away_team_goals=1
date=2022-04-30 season=2021     home_team=Tranmere Rovers       away_team=Oldham Athletic       home_team_goals=2       away_team_goals=0
date=2022-05-02 season=2021     home_team=Port Vale     away_team=Newport County        home_team_goals=1       away_team_goals=2
date=2022-05-02 season=2021     home_team=Salford City  away_team=Mansfield Town        home_team_goals=2       away_team_goals=2
date=2022-05-07 season=2021     home_team=Barrow        away_team=Northampton Town      home_team_goals=1       away_team_goals=3
date=2022-05-07 season=2021     home_team=Bradford City away_team=Carlisle United       home_team_goals=2       away_team_goals=0
date=2022-05-07 season=2021     home_team=Bristol Rovers        away_team=Scunthorpe United     home_team_goals=7       away_team_goals=0
date=2022-05-07 season=2021     home_team=Exeter City   away_team=Port Vale     home_team_goals=0       away_team_goals=1
date=2022-05-07 season=2021     home_team=Harrogate Town A.F.C. away_team=Sutton United home_team_goals=0       away_team_goals=2
date=2022-05-07 season=2021     home_team=Hartlepool United     away_team=Colchester United     home_team_goals=0       away_team_goals=2
date=2022-05-07 season=2021     home_team=Leyton Orient away_team=Tranmere Rovers       home_team_goals=0       away_team_goals=1
date=2022-05-07 season=2021     home_team=Mansfield Town        away_team=Forest Green Rovers   home_team_goals=2       away_team_goals=2
date=2022-05-07 season=2021     home_team=Newport County        away_team=Rochdale      home_team_goals=0       away_team_goals=2
date=2022-05-07 season=2021     home_team=Oldham Athletic       away_team=Crawley Town  home_team_goals=3       away_team_goals=3
date=2022-05-07 season=2021     home_team=Stevenage Borough     away_team=Salford City  home_team_goals=4       away_team_goals=2
date=2022-05-07 season=2021     home_team=Walsall       away_team=Swindon Town  home_team_goals=0       away_team_goals=3

データを挿入します:

INSERT INTO football FROM INFILE 'football.tskv' FORMAT TSKV;

データの読み込み

TSKV フォーマットを使用してデータを読み込みます。

SELECT *
FROM football
FORMAT TSKV

出力は、列名と型を示す 2 行のヘッダー付きのタブ区切り形式になります。

date=2022-04-30 season=2021     home_team=Sutton United away_team=Bradford City home_team_goals=1       away_team_goals=4
date=2022-04-30 season=2021     home_team=Swindon Town  away_team=Barrow        home_team_goals=2       away_team_goals=1
date=2022-04-30 season=2021     home_team=Tranmere Rovers       away_team=Oldham Athletic       home_team_goals=2       away_team_goals=0
date=2022-05-02 season=2021     home_team=Port Vale     away_team=Newport County        home_team_goals=1       away_team_goals=2
date=2022-05-02 season=2021     home_team=Salford City  away_team=Mansfield Town        home_team_goals=2       away_team_goals=2
date=2022-05-07 season=2021     home_team=Barrow        away_team=Northampton Town      home_team_goals=1       away_team_goals=3
date=2022-05-07 season=2021     home_team=Bradford City away_team=Carlisle United       home_team_goals=2       away_team_goals=0
date=2022-05-07 season=2021     home_team=Bristol Rovers        away_team=Scunthorpe United     home_team_goals=7       away_team_goals=0
date=2022-05-07 season=2021     home_team=Exeter City   away_team=Port Vale     home_team_goals=0       away_team_goals=1
date=2022-05-07 season=2021     home_team=Harrogate Town A.F.C. away_team=Sutton United home_team_goals=0       away_team_goals=2
date=2022-05-07 season=2021     home_team=Hartlepool United     away_team=Colchester United     home_team_goals=0       away_team_goals=2
date=2022-05-07 season=2021     home_team=Leyton Orient away_team=Tranmere Rovers       home_team_goals=0       away_team_goals=1
date=2022-05-07 season=2021     home_team=Mansfield Town        away_team=Forest Green Rovers   home_team_goals=2       away_team_goals=2
date=2022-05-07 season=2021     home_team=Newport County        away_team=Rochdale      home_team_goals=0       away_team_goals=2
date=2022-05-07 season=2021     home_team=Oldham Athletic       away_team=Crawley Town  home_team_goals=3       away_team_goals=3
date=2022-05-07 season=2021     home_team=Stevenage Borough     away_team=Salford City  home_team_goals=4       away_team_goals=2
date=2022-05-07 season=2021     home_team=Walsall       away_team=Swindon Town  home_team_goals=0       away_team_goals=3

フォーマットの設定