'Is SQLite useful for THIS purpose?
I've written a multi-threaded bot in Python that uses requests.
I want to read and write the output to a file at the same time. You can think of it like an endless loop.
Through research I found out that you can lock and unlock files for other threads. But it doesn't seem to work on Windows, e.g. the fcntl module.
So I'm looking for alternatives. I've never created a database so I'm wondering if SQLite would be suitable for my purpose? That I can read and write the content at the same time without loosing data? :)
Solution 1:[1]
Altough the question may be a bit vague, I'll try to answer it anyway.
As SQLite is a transactional Database which complies to the ACID principles:
- Atomicity
- Consistency
- Isolation
- Durability
I don't see a reason why it should not work in your use case.
You should read up on the mentioned principles, as there is an abundance of resources available for doing so I won't bother trying to reformulate the definitions here and will provide corresponding URLs instead.
https://en.m.wikipedia.org/wiki/ACID https://www.sqlite.org/transactional.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
