SQLite

该引擎允许导入和导出数据到SQLite,并支持查询SQLite表直接从ClickHouse。

创建数据表

  1. CREATE TABLE [IF NOT EXISTS] [db.]table_name
  2. (
  3. name1 [type1],
  4. name2 [type2], ...
  5. ) ENGINE = SQLite('db_path', 'table')

引擎参数

  • db_path — SQLite数据库文件的具体路径地址。
  • table — SQLite数据库中的表名。

使用示例

显示创建表的查询语句:

  1. SHOW CREATE TABLE sqlite_db.table2;
  1. CREATE TABLE SQLite.table2
  2. (
  3. `col1` Nullable(Int32),
  4. `col2` Nullable(String)
  5. )
  6. ENGINE = SQLite('sqlite.db','table2');

从数据表查询数据:

  1. SELECT * FROM sqlite_db.table2 ORDER BY col1;
  1. ┌─col1─┬─col2──┐
  2. 1 text1
  3. 2 text2
  4. 3 text3
  5. └──────┴───────┘

详见