Installation
Install the SQLite connector:Configuration
connection.yaml
The
filename path is relative to your sources directory, not your project root.Configuration Parameters
SQLite database filename. Path is relative to your sources directory.
Features
Type Mapping
SQLite has dynamic typing, but the connector infers Evidence types:- Numbers: INTEGER, REAL, NUMERIC
- Strings: TEXT, VARCHAR, CHAR
- Dates: Date/timestamp columns (stored as TEXT or INTEGER in SQLite)
- Booleans: INTEGER values (0 = false, non-zero = true)
Date Handling
SQLite stores dates as strings or integers. The connector automatically converts date columns to JavaScript Date objects based on inferred column types.Read-Only Access
Connections are opened in read-only mode to prevent accidental modifications to your database.Streaming Results
Results are streamed in batches (default 100,000 rows) for efficient memory usage.Example Query
Create a SQL file in your Evidence project:queries/user_signups.sql
SQLite Functions
Date Functions
queries/date_examples.sql
Aggregation Functions
queries/aggregations.sql
JSON Functions (SQLite 3.38.0+)
queries/json_data.sql
Creating a SQLite Database
You can create a SQLite database for use with Evidence:Using Python
create_database.py
Using SQLite CLI
Using DuckDB
Export data from DuckDB to SQLite:Performance Tips
Create Indexes
Add indexes to commonly queried columns:Use Query Planning
Analyze query performance:Analyze Tables
Keep statistics up to date:Limitations
Concurrent Access
SQLite databases can have issues with concurrent writes. Since Evidence opens connections in read-only mode, this is generally not a problem for analytics use cases.Size Limitations
While SQLite can theoretically handle databases up to 281 TB, practical limits depend on your system. For very large datasets (> 1GB), consider DuckDB or a client-server database.No Network Access
SQLite is a file-based database. For remote access, consider:- Syncing the database file to your Evidence instance
- Using a different database system
- Converting to DuckDB or MotherDuck for cloud access
Use Cases
Embedded Analytics
SQLite is perfect for:- Bundling data with your Evidence project
- Local development and testing
- Small to medium datasets (< 1GB)
- Offline analytics
Data Distribution
Distribute your SQLite database with your Evidence project:Troubleshooting
File not found errors
File not found errors
- Verify the
filenamepath is relative to your sources directory - Check that the
.sqlitefile exists at the specified location - Ensure the file has read permissions
Database is locked
Database is locked
- Ensure no other processes have the database open for writing
- Close any SQLite GUI tools (DB Browser, etc.)
- The connector uses read-only mode to minimize locking issues
Date parsing issues
Date parsing issues
SQLite stores dates as TEXT or INTEGER. Ensure dates are in ISO 8601 format:
YYYY-MM-DDfor datesYYYY-MM-DD HH:MM:SSfor timestamps
Performance issues with large datasets
Performance issues with large datasets
- Add indexes to filtered columns
- Run ANALYZE to update query planner statistics
- Consider migrating to DuckDB for datasets > 1GB