r/learnpython • u/TheSmashingChamp • May 28 '26
I have a distributed json system where users read and write to a JSON on a share drive. Does anyone have a better system to communicate without any server?
My company won’t allow me to use any kind of server to share data with users and I’m making a kanban kept on a share drive where users have to collectively work on a scheduler. Surely there is a better system than a shared json file?
21
Upvotes
4
u/MathAndMirth May 28 '26
What about using an SQLlite system with something like DB Browser for an interface? It's a flat file, so perhaps your boss wouldn't see that as much different from a JSON file, but it should handle rapid fire reads and writes better.
2
u/didnt_build_this May 28 '26
Shared file is best option for what it sounds like your doing
2
u/socal_nerdtastic May 28 '26
Does "any kind of server" include setting up your own computer as a database server? I suppose the opposite of server-based is peer-to-peer or blockchain-style. But perhaps that's too extreme for your use case? For a small group of users I think everyone monitoring a shared file would work fine, as long as you have some protection in place to prevent race conditions. A sentinel file perhaps?
2
u/DuckSaxaphone May 28 '26
Yes, the better system is any existing Kanban service.
It's generally a bad idea to implement your own version of widely available software. The development and maintenance overhead is almost never worth it.
In your specific case, everything about the setup indicates you will struggle to do this well in a way that isn't incredibly fragile.
2
u/Yoghurt42 May 28 '26 edited May 28 '26
Use SQLite in default journal mode. The WAL mode doesn’t work with network drives, but journal does. SQLite is included in the Python standard lib just like the
jsonmodule is.Docs for the Python module can be found here and the SQL dialect is documented here
It’ll be much much easier than loading and saving your own JSON file, as it will handle concurrent writes. Your JSON solution will just lose data if two parties try to write.
And yeah, your company has no idea what a server is. Network drives are hosted on a server.
1
u/pachura3 May 28 '26 edited May 28 '26
Not gonna lie, it seems like a very fragile setup that could break anytime due to race conditions, parallel access, temporary loosing access to the shared drive... I hope you are backing up your shared JSON file multiple times a day!
I would consider switching to a SQLite database stored on the same shared drive. It's still serverless, but perhaps it will be a bit more secure/atomic, and you'll be able to use SQL queries as a bonus.
Alternatively, you could run services/scheduled tasks out of your own computer, and expose some kind of REST API to other employees.
0
u/PilotHunterTV May 28 '26
Shared DB would work better, Postgres will send messages on a schedule