ipazc / pymdict Goto Github PK
View Code? Open in Web Editor NEWmongodict is a python's dictionary supported by a mongo db.
License: MIT License
mongodict is a python's dictionary supported by a mongo db.
License: MIT License
The bulk operations are not improving too much the speed. A research in the code shows that on each addition or modification during a bulk operation, the dictionary is marked as "modified" which requires a call to the database.
Relevant lines:
class BulkMongoDict(MongoDict):
...
def __setitem__(self, key, value):
self._on_modified_callback()
self._operations.append(
UpdateOne({"key": key}, {"$set": {"value": value}}, upsert=True)
)
if len(self._operations) > self._buffer_size:
self.commit()
def __delitem__(self, key):
self._on_modified_callback()
self._operations.append(
DeleteOne({"key": key})
)
if len(self._operations) > self._buffer_size:
self.commit()
A solution would be to delay the modified mark until a commit is performed.
OS: Debian 9
Python: 3.5.3
Pymdict: 0.0.2
My dictionary is not aware of external (outside of my process) forks of it. Example to replicate it:
Process1:
>>> a = MongoDict("a")
>>> a["foo"] = "bar"
>>> sleep(4)
>>> a["foo"] = "fa"
Process2:
>>> a = MongoDict("a")
>>> sleep(2)
>>> b = a.fork("b") # It is supposed that b["foo"] == "bar" in the fork
>>> sleep(5)
>>> print(b["foo"])
fa
OS: Debian9
Python: 3.5.3
Pymdict: 0.0.2
A query call can be invoked as follows:
m = MongoDict("example")
query_elements = m('value % example')
However, when it is only required the count of the elements, it can be done as follows:
m = MongoDict("example")
query_count = m('value % example', count_only=True)
It is supposed that query_count
will hold the number of elements that matches the query. However, it is returned an invalid generator.
OS: Debian9
Python: 3.5.3
Pymdict: 0.0.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.