Comments (6)
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.
Thank you for your quick reply,
It is now working as we wanted using sqlite.
(see Flowtter/crispy@1df46b0)
from mongo-thingy.
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.
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.
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.
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)
- How to specify the collection name of mongodb HOT 2
- PyMongo 3.6.0 support
- Test against all supported versions of dependencies, not just one HOT 1
- Support other back-ends than PyMongo HOT 4
- Github corner
- Use alabaster Sphinx theme
- Implement Cursor.delete()
- Should we drop PyMongo<3.5 support? HOT 1
- Replace deprecated .insert by .insert_one HOT 1
- mongo_thingy doesn't create indexes HOT 3
- [Feature] Support Transactions HOT 2
- JSON serialization is failing for Thingy classes. HOT 2
- Convert ObjectId to string id for all the view HOT 2
- How to refresh/ reload data from database? HOT 7
- Remove six
- Use Pydantic for the views!
- Add type hints and have the CI run Mypy
- Improve the documentation
- Switch to mkdocs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-thingy.