r/sqlite • • 22d ago

[Showoff Saturday] I built a 100% client-side, in-browser SQLite editor using WebAssembly (No backend, offline-first)

2 Upvotes

I wanted to share a project I've been working on: sqliteWeb, a lightweight SQLite editor that runs entirely inside the browser. link sqlite_visual_editor
I needed a fast way to inspect and query .sqlite / .db files on machines where I didn't want to (or couldn't) install desktop clients like DB Browser. Existing web tools often require uploading files to a remote server, which is a major privacy concern.

Would love to get your feedback on performance, UI responsiveness, or features you'd like to see added!


r/sqlite • • 22d ago

DB SECURITY

0 Upvotes

Hello DEVS,
Hope this message finds you well,

I have a question, im working on a DB salting and hashing should i use argon2id or SHA256 to secure my DB?

also based on what i add the salt Uname, randomlyGen?

Bset regards,


r/sqlite • • 22d ago

I learned to treat shipped SQLite migrations as immutable history (SQLx + Tauri)

Post image
0 Upvotes

One database rule feels overly strict during development but becomes important after shipping:

Never edit a migration that has already reached users.

I'm building a local-first desktop app with Tauri 2, Rust, SQLite, and SQLx. While documenting the persistence boundary, I wrote down a few migration rules worth discussing—especially for desktop apps where the database may contain years of user-created work.

The tempting workflow

  1. Create 0001_initial.sql.
  2. Run the app locally.
  3. Notice a missing column.
  4. Edit 0001_initial.sql.
  5. Delete the local database and try again.

Everything looks fine because the local database is disposable.

A shipped user's database is not. SQLx records applied migration versions and checksums in _sqlx_migrations. If a later binary contains different contents for an already-applied migration, the checksum no longer matches and SQLx refuses to continue.

That's a good failure. The binary should not silently rewrite the history of how the user's schema was created.

Add a new version

Instead of editing a shipped file:

migrations/
├── 0001_spaces.sql
└── 0002_add_space_color.sql

A simple additive migration might be:

ALTER TABLE spaces
ADD COLUMN color TEXT NOT NULL DEFAULT 'blue';

For more complex SQLite changes—such as changing a CHECK constraint or adding a foreign key—you may need a table rebuild in a new migration. That rebuild must preserve relevant rows, indexes, triggers, foreign keys, and dependent objects.

New required values should be backfilled as part of the migration. Destructive changes deserve explicit review.

Two errors should not trigger an automatic reset

  • A checksum mismatch usually means a developer changed a migration that had already shipped.
  • An unknown newer migration may mean the database was opened by a newer application and the current binary is older.

In either case, silently deleting the database is the wrong recovery strategy. Preserve the original data and report the incompatibility.

The test that matters is an upgrade test

Creating the latest schema from scratch is necessary, but it does not prove an upgrade is safe.

A useful test starts from a historical schema, inserts representative old rows, runs the new migrations, then asserts the new schema and surviving data.

Knovum has an upgrade test module at src-tauri/src/spaces/db/tests/upgrades.rs. It migrates to a previously shipped version, inserts representative records, applies the current migration history, and checks the final schema and retained data. Release acceptance also requires testing against a library created by the previous release.

The WebView does not get SQL access

The persistence boundary is:

Vue WebView
   -> typed Tauri command
   -> Rust feature owner
   -> SQLx transaction
   -> SQLite

The renderer does not send SQL strings. It requests domain operations such as renaming a Space. Rust owns the query and transaction scope. A multi-statement invariant stays inside one SQLx transaction instead of being split across IPC round trips.

Questions for people who have shipped desktop apps

  1. Do you enforce migration immutability in CI, or rely on code review?
  2. Do you keep upgrade fixtures for every released schema, or only test the immediately previous release?
  3. How do you handle downgrade attempts when a user launches an older desktop build against a newer local database?
  4. For SQLite table rebuilds, what has been easiest to forget: indexes, triggers, foreign keys, or something else?

My current approach is forward-only migrations, historical-schema upgrade tests, and refusing to reset user data as an automatic recovery path.

These constraints come from building Knovum, a local-first desktop app. The repository and engineering notes are here: github.com/madebyzan/knovum.


Code snippets are simplified examples. The repository's current migrations and tests are the source of truth.


r/sqlite • • 23d ago

DDGBasic: a BASIC dialect where SQLite is built in, so SQL statements are just statements

8 Upvotes

Github Link here: https://github.com/ddgflorida/DDGBasic

DDGBasic wraps a procedural language around SQLite and DuckDB. SQL is written straight into the program, query results come back as rows you can loop over, and program variables go into queries as bind variables (:name). Around the SQL you get what SQL lacks: variables, IF rules, loops, functions, error handling, files, HTTP and a text-mode UI.

  • Load, clean and check data in one statement: LOAD CSV calls your own BASIC functions on every cell (TRANSFORM phone WITH normalize_phone$) and drops rows that fail a check (VALIDATE email WITH is_valid_email).
  • Rules over query results: FOR row IN (SELECT ...) loops apply logic that is awkward in SQL (tiers, allocations, alerts) and write back with bind variables, inside transactions.
  • Two engines in one program: SQLite for records (a file, constraints, transactions), DuckDB for analytics (columnar, fast, querying Parquet and CSV files directly), with DATABASE ENGINE to switch.
  • Results anywhere: the same query to the console, CSV, JSON, Excel, Parquet, HTML or SQL, or to a grouped REPORT.

The language is a modern BASIC, and it comes with 1990s-style text screens and a QBasic-style IDE. See Examples for programs that show this off.

Easy install with- pip install ddgbasic

  • ddgbasic examples/hello.bas # run a script
  • ddgbasic # interactive REPL
  • ddgbasic --ide examples/contact.bas # the QBasic-style IDE: F5 runs, F1 helps

r/sqlite • • 26d ago

iOS viewer for Sqlite

3 Upvotes

Hello, adding here my latest app (OmniFile Studio) which supports multiple types of file as a quicklook plugin on iOS. From them I also supports sqlite, it gets preview, filters, schema view, and many more.

If's a free app, with an optional pro unlock, happy to provide codes to try it.


r/sqlite • • 26d ago

WinSQLite Editor in your Browser

Post image
1 Upvotes

r/sqlite • • 26d ago

WinSQLite Editor in your Browser

Post image
0 Upvotes

link in comment


r/sqlite • • 27d ago

Need advice regarding internships

2 Upvotes

I'm bcom 1st yr

How many days/weeks/months does it take to learn SQL, Power Bi and relevant skills for a business analysis internship?

Pls share any advices n suggestions..

I'd be grateful if someone shared the sources and roadmap🙏🙏..


r/sqlite • • 29d ago

Quick Data Insights is free now

Thumbnail gallery
9 Upvotes

Hello, I have posted here before about my mac quicklook plugin Quick Data Insights as a sqlite viewer which was paid before, wanted to post again as I now made it free with the same exact functionality posted before.

I also added an optional pro in-app to add column insights, and a sql query functionality for all data files not only sqlite.


r/sqlite • • Nov 02 '26

GitHub - srdzank/WinSQLite-Editor: SQLite-Editor

Thumbnail github.com
2 Upvotes

r/sqlite • • Oct 31 '26

My first PowerShell module: A local NoSQL-style database built on top of SQLite

0 Upvotes

Hey everyone!

I wanted to share my first PowerShell module, PSLocalBase, an open-source local database I've been working on.

The idea came from wanting a simple and efficient way to store, manage, and query structured data locally in PowerShell without constantly reading and writing large JSON files or having to write long, complex SQL queries.

PSLocalBase is a lightweight, local NoSQL-style document database built on top of Windows' native SQLite engine (winsqlite3.dll), leveraging SQLite's built-in JSON functions for storing, filtering, querying, and manipulating JSON documents.

It combines the simplicity of a document-oriented API with SQLite's performance, reliability, and ACID transactions, all without external dependencies or a separate database server.

Some features:

  • No external dependencies on modern Windows systems
  • Compatible with Windows PowerShell 5.1 and PowerShell 7+
  • Local database storage with collections and JSON documents
  • Filtering, sorting, indexing, and advanced queries
  • ACID transactions and persistent storage
  • Native PowerShell objects with nested JSON support
  • A WPF playground for exploring and testing local databases

Quick example:

$db = [PSLocalBase]::new("./mydata.db")

$db.collection("users").doc("user1").set(@{
    name   = "John"
    role   = "Admin"
    active = $true
})

$admins = $db.collection("users").
    where("role", "=", "Admin").get()

$db.close()

Everything runs locally, with no database server or external service required.

Installation:

Install-Module PSLocalBase -Scope CurrentUser

It's been a great learning experience, especially working with PowerShell classes, SQLite's native API, and compatibility between PowerShell 5.1 and 7.

This is my first PowerShell module, so I'd really appreciate feedback from the community. I'm particularly interested in what you think about the API design, whether you'd find something like this useful in your own PowerShell projects, and what features you think are missing.

GitHub: https://github.com/cmartineztech/PSLocalBase

PowerShell Gallery: https://www.powershellgallery.com/packages/PSLocalBase

AI Disclosure: I used AI coding assistants throughout the development of PSLocalBase for implementation, debugging, testing, and documentation. I have over 12 years of PowerShell experience and directed the project's architecture, design, and technical decisions.

Thanks for checking it out!


r/sqlite • • Oct 27 '26

GitHub - srdzank/WinSQLite-Editor: SQLite-Editor sqlite_vec

Thumbnail github.com
4 Upvotes

r/sqlite • • Oct 26 '26

WAL file grew to 4GB because our metrics scraper held a read txn open for the whole scrape

10 Upvotes

We buffer counter samples into a local SQLite file per host and a Prometheus exporter reads them every 15s. The exporter was opening a transaction, iterating a cursor, and formatting the text exposition inline, so the read txn stayed open for ~2-3 seconds while the HTTP response was written out — long enough that the writer's auto-checkpoints kept bailing and the WAL never truncated. Fix was dumb and obvious in hindsight: read rows into memory, commit, then serialize, plus a `wal_checkpoint(TRUNCATE)` after the nightly delete of old samples. What I'm still unsure about is whether I should set `journal_size_limit` as a safety net or if that just hides the next version of this bug — does anyone rely on it in production, or treat an oversized WAL as a signal worth alerting on?


r/sqlite • • Oct 25 '26

Soft delete vs hard delete: the case for each, and what would decide it for me

7 Upvotes

A decision that looks small and tends to stick for the life of a system. Here are both sides, written as fairly as I can.

The case for soft delete (a deleted_at column instead of removing the row)

  • Undo is easy: restore the row, clear the column.
  • Foreign keys from other tables stay valid, so history like “this order belonged to a customer who later left” still resolves.
  • You keep an audit trail without a separate mechanism.
  • Support teams like being able to see what was removed and when.

The case against

  • Every query has to remember WHERE deleted_at IS NULL. One forgotten filter and removed data leaks into a screen, a report or an export.
  • Unique constraints get awkward. If a user deletes their account and signs up again with the same email, a plain unique index on email blocks it. In Postgres you can use a partial unique index, WHERE deleted_at IS NULL; other databases handle this differently, so check yours.
  • Tables only grow, and indexes carry rows nobody queries.
  • Real deletion may eventually be required (privacy or retention rules), so “soft” deletion can turn into a second deletion project later.
  • Cascading is ambiguous: when a parent is soft-deleted, what happens to its children?

What hard delete plus something else looks like

  • Delete the row, and write the old version to an audit or archive table, or emit an event, if you need history.
  • Cleaner queries and constraints, at the cost of building and maintaining the history mechanism.

What would decide it for me:

  • Do users or staff actually need undo, or is it only “just in case”?
  • Are there legal or contractual limits on how long deleted data can be kept?
  • How many places query this table? More places means more chances to miss the filter.
  • Will other systems (analytics, search, caches) need to learn about deletes?

I don’t think either is wrong by default. If I had to pick a starting point without knowing the system, I’d lean toward hard delete with an audit trail where retention rules are strict, and soft delete where undo is a real feature. I’m not certain about that split.

Where do you land, and has either choice caused you trouble later?


r/sqlite • • Oct 22 '26

JDER — un editor gratuito per i tuoi diagrammi di informatica

Thumbnail reddit.com
4 Upvotes

r/sqlite • • Oct 22 '26

How do you orchestrate zero-downtime schema migrations across 100+ isolated databases (Database-per-Tenant) while in active beta?

Thumbnail reddit.com
10 Upvotes

r/sqlite • • Oct 22 '26

GitHub - srdzank/WinSQLite-Editor: Official home of the SQLite-Editor

Thumbnail github.com
5 Upvotes

r/sqlite • • Oct 22 '26

I built a free Mac database client because I wanted to stop reaching for the mouse

Thumbnail reddit.com
3 Upvotes

r/sqlite • • Oct 21 '26

jSQLite

0 Upvotes

Hi everyone! I’ve been working on jSQLite, an AI-generated TypeScript translation of SQLite’s read-only C internals, and it’s reached a point where I’d like to share it.

It runs directly in the browser without WebAssembly, native code or a query server. You can open an immutable SQLite database over HTTP and execute queries locally.

It supports a broad range of common SQL constructs, including joins, aggregates, subqueries, CTEs, window functions and JSON functions, along with UTF-8 and both UTF-16 database encodings. Recent work includes STAT4-informed index selection for supported skip-scan paths.

This is a preliminary release, and I’d particularly welcome examples of queries that produce unexpected results. Development uses SQLite 3.53.4 as a pinned reference, with differential tests comparing typed results, column metadata, errors and statement reset behavior.

The translation has been generated using Saivage, an autonomous software-development system I’m also building. jSQLite is one of my projects for testing that system against a substantial engineering problem.


r/sqlite • • Oct 19 '26

Check SQLite table size with .diskused and dbstat

Thumbnail importstatic.com
14 Upvotes

r/sqlite • • Oct 19 '26

Fastest Python ORMs for SQLite: peewee, SQLAlchemy and SQLModel

Thumbnail github.com
5 Upvotes

r/sqlite • • Oct 17 '26

I built ivmlite, an experimental incremental GROUP BY extension for SQLite

5 Upvotes

I've been working on ivmlite, a SQLite loadable extension that maintains a fixed grouped COUNT(*) and/or integer SUM(column) query. It captures ordinary writes with triggers; the application explicitly refreshes the materialized result when it needs a current answer. The first technical preview is available here: https://github.com/SFARL/ivmlite

I built it for recurring dashboard-style aggregates over large mutable tables with relatively small write batches. It is a narrow SQL subset, not a general materialized-view engine: STRICT tables with INTEGER/TEXT columns, bare-column GROUP BY, one optional simple predicate, and one optional inner equijoin. No global aggregates, MIN/MAX/AVG, aggregate expressions, or arbitrary rolling windows yet.

For an adapted *synthetic* OpenWhispr workload (2M transcript segments, 20K notes, 200-operation mixed batches), the local M2 Pro end-to-end median was 418 ms per batch with full SQLite recomputation versus 14.9 ms with ivmlite. The tradeoff was about 8 seconds of initial bootstrap and 4.76x the base database's SQLite pages. This is not a measurement of OpenWhispr itself, and that demo did not compare against hand-written triggers. Method and raw results: https://github.com/SFARL/ivmlite/blob/master/docs/demos/openwhispr.md

I'd value criticism from SQLite users: where would a covering index or a simple transactional rollup be the better choice? If you have a real repeated aggregate, I'd also be interested in its SQL/schema, rough row count, read/write cadence, and freshness requirement. I can check whether the current subset fits and build an oracle-checked reproduction.


r/sqlite • • Oct 17 '26

Row Level Security in SQLite on Cloudflare

Thumbnail mainbrella.com
11 Upvotes