PgNative logoPgNative
← All posts

SQLite for Local Development: A Practical Workflow

Use SQLite for fast local iteration, then deploy to Postgres or MySQL. File paths, pragmas, and inspecting data with a desktop GUI.

7 min readSQLiteDevelopmentWorkflow

SQLite is a full SQL engine in a single file. Teams adopt it for integration tests, offline prototypes, and CLI tools because there is no server to install. The challenge is visibility: without a GUI you are guessing table contents from printf debugging. A desktop client makes SQLite feel as approachable as cloud Postgres.

When SQLite fits local dev

  • ORM integration tests that need a fresh database per test run
  • Electron or mobile apps with on-device storage
  • Data analysis on exported CSV merged into a scratch database
  • Teaching SQL without Docker networking issues

File paths and connection strings

SQLite connections point at a file path. Relative paths resolve from the process working directory, which surprises people running tests from IDE vs terminal. Prefer absolute paths in saved GUI connections or environment variables like SQLITE_PATH=./tmp/dev.db.

-- Quick sanity check
SELECT name FROM sqlite_master WHERE type = 'table';

Pragmas worth knowing

  • foreign_keys = ON for referential integrity in tests
  • journal_mode = WAL for concurrent readers during dev servers
  • busy_timeout to reduce database is locked errors under parallel tests

SQLite vs server databases

Types are flexible (affinity) compared to Postgres strict typing. Migrations written only against SQLite may hide incompatibilities until staging. Run at least one pipeline job against Postgres or MySQL before release. Use the same GUI to open SQLite locally and Postgres in staging so muscle memory transfers.

Inspecting data in PgNative

Create a SQLite connection with the path to your .db file. Browse tables like any other engine, run SELECT with pagination, and use filters to find rows matching a bug report. Pro adds CSV export when you need to attach data to a ticket. Because PgNative also speaks Postgres and MySQL, you can compare a SQLite repro against staging data side by side with two windows.

Common pitfalls

  1. Committing the database file to git (use templates or migrations instead).
  2. Forgetting WAL files (.db-wal) when zipping a repro.
  3. Assuming AUTOINCREMENT behaves exactly like SERIAL in Postgres.
  4. Running destructive migrations without a file copy backup.

Takeaway

SQLite accelerates local feedback loops. Pair it with a lightweight GUI and disciplined promotion path to your server database, and you keep speed without losing production fidelity. When you deploy, read MySQL vs PostgreSQL for developers to pick the right server engine.

Try PgNative on your databases

Native PostgreSQL client for Mac and Windows. Free to start — Pro unlocks export, tabs, and advanced filters.