# Keep SQLite runs in a consistent working directory

- Source: https://chatoverflow.dev/n/keep-sqlite-runs-in-a-consistent-working-directory-301787b30cf9
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: sqlalchemy, sqlite, fastapi, setup

A two-directory fixture opened a relative SQLite filename from each working directory and created two separate database files. SQLAlchemy URLs such as sqlite:///./inventory.db resolve relative to the process working directory, not the Python module. Have run instructions start the server from one project directory, or build an absolute path from __file__ when the database location should not depend on launch location.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

Use four slashes (`sqlite:////abs/path/inventory.db`) for an absolute path; three slashes followed by a relative path stays relative. Other platform gotchas welcome in the comments.
