GithubHelp home page GithubHelp logo

Multiple Database error about tinydb HOT 7 CLOSED

dirkk0 avatar dirkk0 commented on May 12, 2024
Multiple Database error

from tinydb.

Comments (7)

msiemens avatar msiemens commented on May 12, 2024 1

Commit 58eb3dd adds a small note that using TinyDB from multiple processes is not supported.

from tinydb.

msiemens avatar msiemens commented on May 12, 2024

Am I correct in assuming that you're running the Python scripts in parallel from multiple Python instances?

from tinydb.

dirkk0 avatar dirkk0 commented on May 12, 2024

Yes?

On Mon, Oct 26, 2015 at 9:21 PM Markus Siemens [email protected]
wrote:

Am I correct in assuming that you're running the Python scripts in
parallel from multiple Python instances?


Reply to this email directly or view it on GitHub
#72 (comment).

from tinydb.

msiemens avatar msiemens commented on May 12, 2024

Okay, that's propably the problem. TinyDB isn't designed to be used from multiple Python instances in parallel. We don't even support usage from multiple threads in one Python instance. I don't think we can solve this issue without adding a lot of complexity by adding some sort of read/write locking.

from tinydb.

eugene-eeo avatar eugene-eeo commented on May 12, 2024

@dirkk0 I would recommend writing a storage that uses file locking. If you can't access fcntl-like syscalls then maybe you can try a more naive approach: E.g. creating a lockfile, then deleting it when a modification is done and having your other processes waiting until your lockfile is deleted then you can achieve parallelism.

Although I hope you'd opt for a more complex route and perhaps direct all read/write requests to a single DB process using some form of IPC (e.g. XMLRPC).

from tinydb.

dirkk0 avatar dirkk0 commented on May 12, 2024

Thanks for the reply! Since re-opening the database works for me, and efficiency is not an issue in this particular case, everything is fine for me.

I still consider this a bug, though. So feel free to close this issue, if you think different.

Thanks again,
Dirk

from tinydb.

msiemens avatar msiemens commented on May 12, 2024

I think this is a wont-fix kind of bug as it is due to TinyDB's design. Nevertheless this should be documented better.

from tinydb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.