# SQLite

Bobby Tables opens SQLite database files on this computer in a SQL workspace, with no server to run.

## Where to find it

| Action | How |
| --- | --- |
| Save a SQLite connection | `New connection`, `⌘N` (`Ctrl+N`), then `SQLite` under `Choose a provider` |
| Open a file without saving it | `Open SQLite file...` in the Home screen's connection actions menu |
| Open from the desktop | `Open With` on a `.sqlite`, `.sqlite3`, `.db` or `.db3` file |
| Drop a file | Drag a database file onto the window |
A file opened without a saved connection shows `Save connection` in the status bar.

## Connecting

The form has a `Database file` section with a `Path` field and a folder button that opens the file picker. `Create new database...` creates an empty file at a location you choose before you save. A local file has no host, port, TLS or SSH tunnel.

## What works

- Browse tables, views, indexes and triggers in the [table grid](https://bobbytables.app/docs/table-data), with attached databases shown as schemas.
- Stage inserts, updates and deletes, then commit them in one transaction, as described in [Editing](https://bobbytables.app/docs/editing).
- Change columns, indexes and keys in the [Structure](https://bobbytables.app/docs/structure) tab, with the changes run inside a transaction.
- Take a [snapshot](https://bobbytables.app/docs/snapshots) as a SQL script or as a copy of the database file.
- Draw a [schema diagram](https://bobbytables.app/docs/schema-diagram) from declared foreign keys.
- Format result columns with [result directives](https://bobbytables.app/docs/result-directives).
- Stop a running statement with `Cancel`, `⌘.` (`Ctrl+.`), which interrupts SQLite.
- Run `Explain`, `⌘⇧E` (`Ctrl+Shift+E`), in the [SQL editor](https://bobbytables.app/docs/sql-editor).

## Engine notes

`Open in read-only mode` opens the file with SQLite's read-only flag, so SQLite refuses writes even from the SQL editor. SQLite allows one writer at a time, and the app waits briefly for another process's lock before a write fails. A table without a primary key is edited by SQLite `rowid`, which stays hidden from the grid. The snapshot dialog also offers `Database file (page copy)` and `Database file, compacted`, which are staged in this computer's temporary directory first.

## Good to know

- A SQLite connection opens one file, so `Switch database` is not available.
- SQLite connections cannot be copied as URLs.

## Related

- [Connections](https://bobbytables.app/docs/connections.md)
- [Snapshots](https://bobbytables.app/docs/snapshots.md)
- [Editing](https://bobbytables.app/docs/editing.md)
- [Engines, file sources and platforms](https://bobbytables.app/docs/engines.md)
