foreword

  • This article applies to ClickHouse 22.3
  • Official document: Inserting Data from a File , which is to put the data file path directly into SQL , it is useless to redirect

JSON format

  • export statement

     clickhouse-client -h 127.0.0.1 --port 9000 -u default --password XXX -d mylog \
     --query "SELECT * from mylog.mylog" --format JSONEachRow > 2021.big_json
  • import statement

     clickhouse-client -h 127.0.0.1 --port 9000 -u default --password XXX -d mylog \
     --query "INSERT INTO mylog.mylog FORMAT JSONEachRow" < 2021.big_json

Native format

  • export statement

     clickhouse-client -h 127.0.0.1 --port 9000 -u default --password XXX -d mylog \
     --query "SELECT * from mylog.mylog" --format Native > 2021.native
  • import statement

     clickhouse-client -h 127.0.0.1 --port 9000 -u default --password XXX -d mylog \
     --query "INSERT INTO mylog.mylog FORMAT Native" < 2021.native
This article is from qbit snap

qbit
268 声望279 粉丝