SQLite
SQLite is a lightweight, file‑based database system that lets you store, retrieve, and manage data right inside your Nappai dashboard. With this component you can create new tables, insert data, run custom SQL commands, or simply pull information about the database itself—all without writing any code.
How it Works
When you add the SQLite component to a workflow, it opens a connection to a local SQLite file. Depending on the operation you choose, the component will either:
- Add – Create a new table and insert the data you provide.
- SQL – Execute any SQL statement you write and return the result.
- DatabaseInfo – Read the file and give you details such as the number of tables, size, and other metadata.
All actions happen locally on the machine running Nappai, so there’s no external API call. The component simply reads from or writes to the SQLite file you specify.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Add: Create a new table in the database and insert the data you provide.
- SQL: Run a custom SQL query against the database and return the result.
- DatabaseInfo: Retrieve metadata about the database, such as the list of tables and their sizes.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Ingest Data: The data you want to add to a new table.
- Visible in: Add
-
Operation: Choose which action the component should perform.
- Visible in: Add, SQL, DatabaseInfo
-
Database Name: The file name (or path) of the SQLite database you want to work with.
- Visible in: Add, SQL, DatabaseInfo
-
Persist Directory: The folder where the database file will be stored or read from.
- Visible in: Add, SQL, DatabaseInfo
-
Search Query: The SQL statement you want to execute.
- Visible in: SQL
-
Table Name: The name of the table you want to create or query.
- Visible in: Add
-
Drop Table: If checked, the component will delete the specified table before creating a new one.
- Visible in: Add
Outputs
- Data: The result of a SQL query or the data you inserted. This output can be fed into other components that need the data.
- Database Info: Metadata about the database, such as the list of tables, their sizes, and the total number of rows. Useful for monitoring or reporting.
- Database Schema: The structure of the tables in the database, returned as a data table. Handy when you need to understand the layout before querying.
Usage Example
Example 1 – Adding a Table (Add)
- Operation: Add
- Database Name:
sales.db
- Persist Directory:
/data/databases
- Table Name:
customers
- Drop Table: Checked (optional)
- Ingest Data: Provide a CSV or JSON table with customer records.
The component will create customers
in sales.db
and insert the rows. The Data output will contain the inserted rows, ready for further processing.
Example 2 – Running a Query (SQL)
- Operation: SQL
- Database Name:
sales.db
- Persist Directory:
/data/databases
- Search Query:
SELECT * FROM customers WHERE country = 'USA';
- Table Name: (leave blank)
The component runs the query and returns the matching rows in the Data output.
Example 3 – Getting Database Info (DatabaseInfo)
- Operation: DatabaseInfo
- Database Name:
sales.db
- Persist Directory:
/data/databases
The component returns a table with metadata such as table names, row counts, and file size in the Database Info output.
Related Components
- Data Input – Bring data into the workflow from files or other sources.
- Data Output – Export data to CSV, Excel, or other destinations.
- SQL Query – Build and run SQL queries without using the SQLite component directly.
- File Manager – Manage file paths and directories for database storage.
Tips and Best Practices
- Keep the database file in a secure, backed‑up location to avoid accidental loss.
- Use the Drop Table option only when you’re sure you want to delete existing data.
- For large datasets, consider splitting the data into smaller batches before inserting.
- Regularly run DatabaseInfo to monitor table sizes and keep an eye on growth.
- When writing custom SQL, test the query in a separate SQL editor first to avoid syntax errors.
Security Considerations
- The SQLite file is stored locally; ensure the folder permissions restrict access to authorized users only.
- Avoid embedding sensitive data directly in the Search Query field; instead, use parameterized inputs if possible.
- When using the Add operation, validate the incoming data to prevent accidental injection of malformed records.
- Keep the Nappai instance behind a firewall and use HTTPS for any remote access to the dashboard.