This is the implementation of the SQLite data handler for MindsDB.

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free to use for either commercial or private purpose. SQLite is the most widely deployed database in the world with more applications than we can count, including several high-profile projects.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or use MindsDB Cloud.
  2. To connect SQLite to MindsDB, install the required dependencies following this instruction.
  3. Install or ensure access to SQLite.

Implementation

This handler is implemented using the standard sqlite3 library that comes with Python.

The only required argument to establish a connection is db_file that points to the database file that the connection is to be made to.

Optionally, this may also be set to :memory: to create an in-memory database.

Usage

In order to make use of this handler and connect to the SQLite database in MindsDB, the following syntax can be used:

CREATE DATABASE sqlite_datasource
WITH
    engine = 'sqlite',
    parameters = {
        "db_file": "example.db"
    };

You can use this established connection to query your table as follows:

SELECT *
FROM sqlite_datasource.example_tbl;