GithubHelp home page GithubHelp logo

Use pickle to unknown objects about mongodict HOT 2 CLOSED

turicas avatar turicas commented on September 27, 2024
Use pickle to unknown objects

from mongodict.

Comments (2)

turicas avatar turicas commented on September 27, 2024

I'm considering in do not implementing this issue. I think it should be in a level on top of mongodict (let the developer do this work outside mongodict). Summarizing possible problems:

  • If mongodict tries automatically to pickle the object, it can lead to errors like outdated objects saved in the database (see the example below).
  • We'd need a kind of "protocol" to discover which objects are pickled and which are not. It can be a mess (imagine the collection with lots of non-homogeneous data, but with the same schema).

The problems involving pickled objects are exemplified below:

from mongodict import MongoDict


class MyClass(object):
    pass

obj = MyClass()
obj.test = 123
my_dict = MongoDict()
my_dict['obj'] = obj
obj.python = 'rules'
assert my_dict['obj'] == obj # False

(I think) ZODB solves this problem forcing the developer to subclass a specific Persistent class, so it'll update object info in the database when you update the object automatically but as mongodict is not a object-oriented database, we can't force the developer to do it (maybe a library on top of mongodict can do it).

It's open for discussion.

from mongodict.

turicas avatar turicas commented on September 27, 2024

Implemented on 194333f.

from mongodict.

Related Issues (12)

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.