GithubHelp home page GithubHelp logo

Comments (6)

ramnes avatar ramnes commented on August 24, 2024 2

That was indeed an upstream bug, fixed in davidlatwe/montydb#75. Thank you @dawhn for raising the issue and @davidlatwe for the quick fix!

from mongo-thingy.

dawhn avatar dawhn commented on August 24, 2024 1

Thank you for your quick reply,
It is now working as we wanted using sqlite.

(see Flowtter/crispy@1df46b0)

from mongo-thingy.

ramnes avatar ramnes commented on August 24, 2024

Hey there!

Yes, the first example should work, and I guess this is the error you're getting?

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 connect(client_cls=MontyClient)

File ~/refty/mongo-thingy/mongo_thingy/__init__.py:287, in connect(*args, **kwargs)
    285 def connect(*args, **kwargs):
    286     if AsyncThingy._client_cls is not None:
--> 287         AsyncThingy.connect(*args, **kwargs)
    288     Thingy.connect(*args, **kwargs)

File ~/refty/mongo-thingy/mongo_thingy/__init__.py:134, in BaseThingy.connect(cls, client_cls, database_name, *args, **kwargs)
    131 if not client_cls:
    132     client_cls = cls._client_cls
--> 134 cls._client = client_cls(*args, **kwargs)
    135 try:
    136     cls._database = cls._client.get_database(database_name)

File ~/refty/mongo-thingy/.venv/lib/python3.9/site-packages/montydb/client.py:50, in MontyClient.__init__(self, repository, document_class, tz_aware, **kwargs)
     48 options["document_class"] = document_class
     49 options["tz_aware"] = tz_aware or False
---> 50 self.__options = ClientOptions(options, wconcern)
     51 super(MontyClient, self).__init__(self.__options.codec_options,
     52                                   self.__options.write_concern)

File ~/refty/mongo-thingy/.venv/lib/python3.9/site-packages/montydb/base.py:205, in ClientOptions.__init__(self, options, storage_wconcern)
    203 def __init__(self, options, storage_wconcern=None):
    204     self.__options = options
--> 205     self.__codec_options = bson.parse_codec_options(options)
    207     if storage_wconcern is not None:
    208         self.__write_concern = storage_wconcern

TypeError: 'NoneType' object is not callable

This is a weird one: it seems that it only happens when you already have a .monty.storage file, because it works just as expected when I remove it. So this may be an upstream issue but I'll investigate.

from mongo-thingy.

ramnes avatar ramnes commented on August 24, 2024

In the meantime, if you're only interested in the memory backend of MontyDB, it appears to work as expected and this is how you want to use it:

connect(":memory:", client_cls=MontyClient)

from mongo-thingy.

dawhn avatar dawhn commented on August 24, 2024

Thank you for the answer.
":memory:" should be working for now
We are planning on using flatfile / sqlite how would you suggest using these with mongo-thingy ?

from mongo-thingy.

ramnes avatar ramnes commented on August 24, 2024

SQLite also seems to work as expected:

from mongo_thingy import connect
from montydb import MontyClient, set_storage

set_storage("./data", storage="sqlite")
connect("./data", client_cls=MontyClient)

from mongo-thingy.

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.