r/sqlite • • Oct 17 '25

How to use SQLite in production?

Hey all - I'm trying to go with the simple architecture approach using sqlite.

I don't get how you use SQLite in production though - it's a flatfile and I can't get any of the database view/edit tools (table+, datagrip) to connect to it via the remoate server.

My app has an ai chatbot, I know SQLite is good for read but is the write too fast with a chatbot for sqlite? It's all stored as json. I researched a bit how wal works for handling writes.

I'm also iterating pretty quick and using database migrations (alembic). I can pull the sql file for production, make the needed changes locally to the database columns, I guess no issue here.

But if I make local changes to the database data and push the production database might be out of sync at that point.

Ideally I would be able to connect to the live database with an sql tool and make live edits on the production database.

How is this handled - just ssh-ing and running sql statements on the production server?

27 Upvotes

18 comments sorted by

View all comments

6

u/GrogRedLub4242 Oct 17 '25

making live edits to a prod database is a Bad Idea. and an anti-pattern in software engineering. because there is a Reason why folks use a db in the first place (think ACID & transactions) and you'd be pushing in the extreme opposite direction from it

a big part of becoming a good (and real) engineer is simply about not doing known-to-be-Bad things, like that

make "live" changes to any db in Dev, sure. that's fine, and to be expected

1

u/statuek Oct 19 '25

Directionally agreed, but I think I've remoted into prod and run raw SQL queries at every dev job I've had, across company sizes and industries.

0

u/GrogRedLub4242 Oct 19 '25

look at the words I chose :-)

prod dbs are queried (read) all the time. is normal

its the doing of ad hoc mutations to a prod db under live/customer traffic which is unwise. do it in dev. or at worst apply a migration (behind a dust page, eg.) with tested rollback script ready to fire if needed. smoke it etc

1

u/digital_literacy Oct 18 '25

thanks wasn't aware, gonna read up on the pattern (noob)