This page was recently updated. What do you think about it? Let us know!.

Connect SQLite to your preprocessing pipeline, and use the Unstructured Ingest CLI or the Unstructured Ingest Python library to batch process all your documents and store structured outputs locally on your filesystem.

You will need:

The SQLite prerequisites:

  • A SQLite instance. Download and install SQLite.

  • A SQLite database. Create a database.

  • The path to the database’s .db file.

  • A table in the database. Create a table.

    The table’s schema must match the schema of the documents that Unstructured produces. Unstructured cannot provide a schema that is guaranteed to work in all circumstances. This is because these schemas will vary based on your source files’ types; how you want Unstructured to partition, chunk, and generate embeddings; any custom post-processing code that you run; and other factors.

    You can adapt the following table schema example for your own needs:

    SQLite
    CREATE TABLE elements (
        id TEXT PRIMARY KEY,
        element_id TEXT,
        text TEXT,
        embeddings TEXT,
        parent_id TEXT,
        page_number INTEGER,
        is_continuation INTEGER,
        orig_elements TEXT
    );
    

    See also:

You might also need to install additional dependencies, depending on your needs. Learn more.

The following environment variables:

  • SQLITE_DB_PATH - The path to the database’s .db file, represented by --database (CLI) or database (Python).

These environment variables:

  • UNSTRUCTURED_API_KEY - Your Unstructured API key value.
  • UNSTRUCTURED_API_URL - Your Unstructured API URL.

Now call the Unstructured Ingest CLI or the Unstructured Ingest Python library. The destination connector can be any of the ones supported. This example uses the local destination connector: