SQLite

The engine allows to import and export data to SQLite and supports queries to SQLite tables directly from ClickHouse.

Creating a Table

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

Engine Parameters

  • db_path — Path to SQLite file with a database.
  • table — Name of a table in the SQLite database.

Usage Example

Shows a query creating the SQLite table:

  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');

Returns the data from the table:

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

See Also