2021-08-15 14:11:37 +00:00
|
|
|
---
|
|
|
|
toc_priority: 7
|
|
|
|
toc_title: SQLite
|
|
|
|
---
|
|
|
|
|
|
|
|
# SQLite {#sqlite}
|
2021-08-15 13:53:49 +00:00
|
|
|
|
2021-08-15 16:34:10 +00:00
|
|
|
The engine provide to import and export data to SQLite and query SQLite tables directly in ClickHouse.
|
2021-08-15 13:53:49 +00:00
|
|
|
|
|
|
|
## Creating a Table {#creating-a-table}
|
2021-08-15 16:34:10 +00:00
|
|
|
|
2021-08-15 13:53:49 +00:00
|
|
|
``` sql
|
2021-08-15 16:34:10 +00:00
|
|
|
CREATE TABLE [IF NOT EXISTS] [db.]table_name
|
|
|
|
(
|
|
|
|
name1 [type1],
|
|
|
|
name2 [type2],
|
|
|
|
...
|
|
|
|
)
|
|
|
|
ENGINE = SQLite('db_path', 'table')
|
2021-08-15 13:53:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
**Engine Parameters**
|
|
|
|
|
2021-08-15 16:34:10 +00:00
|
|
|
- `name1, name2, ...` — The column names.
|
|
|
|
- `type1, type2, ...` — The column types.
|
|
|
|
- `db_path` — Path to SQLite file with the database.
|
|
|
|
- `table` — The SQLite table name.
|
2021-08-15 13:53:49 +00:00
|
|
|
|
|
|
|
## Specifics and recommendations {#specifics-and-recommendations}
|
|
|
|
|
|
|
|
Algorithms
|
|
|
|
Specifics of read and write processes
|
|
|
|
Examples of tasks
|
|
|
|
Recommendations for usage
|
|
|
|
Specifics of data storage
|
|
|
|
|
|
|
|
## Usage Example {#usage-example}
|
|
|
|
|
|
|
|
The example must show usage and use cases. The following text contains the recommended parts of this section.
|
|
|
|
|
|
|
|
Input table:
|
|
|
|
|
|
|
|
``` text
|
|
|
|
```
|
|
|
|
|
|
|
|
Query:
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
```
|
|
|
|
|
|
|
|
Result:
|
|
|
|
|
|
|
|
``` text
|
|
|
|
```
|
|
|
|
|
|
|
|
Follow up with any text to clarify the example.
|
|
|
|
|
|
|
|
**See Also**
|
|
|
|
|
2021-08-15 16:34:10 +00:00
|
|
|
- [The `sqlite` table function](../../../sql-reference/table-functions/sqlite.md)
|