This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

persistentdicts

dict-like interfaces for various databases

Key differences with competing projects

If you search on pypi, you will find a few competing projects: pdicts, durabledicts, etc. The key differences between persistentdicts and those are:

  • Implementations of persistentdicts do not keep a local cache dictionary: changes are immediately written to database. Iterators are also proceeding directly on the database. It allows to interact with datasets that would not fit in RAM otherwise.
  • The test suite is significantly bigger than in all the other implementation I have seen. When relevant, tests have been backported from the CPython test suite of dict.
  • Serialization is done in json rather than using pickle.

Gotchas

You can’t modify a value of the dictionary in place. For example:

>>> import persistentdicts

>>> d = persistentdicts.sqlitedict.SqliteDict()
>>> d["a"] = []
>>> d["a"].append(1)

>>> d["a"] # with a normal dict, you would get [1]
[]

That is because d["a"] returns a copy of the database entry for the key "a", and not a reference to a python object. Modifying this copy (with append) does not affect the database itself.

To circumvent this, you should do:

>>> import persistentdicts

>>> d = persistentdicts.sqlitedict.SqliteDict()
>>> d["a"] = []
>>> d["a"] = d["a"] + [1]

>>> d["a"]
[1]

Similarly, setdefault will not work as expected since it does not return a reference to the stored value, but a copy of this value.

>>> import persistentdicts

>>> d = persistentdicts.sqlitedict.SqliteDict()
>>> d.setdefault("a", []).append(1)

>>> d["a"]
[]

Databases supported so far

Done:

  • kyotocabinet
  • sqlite
  • cassandra

Planned:

  • leveldb
  • redis
  • memcachedb
  • lightcloud

You can request new formats on the bug tracker.

Short documentation

persistentdicts.sqlitedict.SqliteDict

persistentdicts.sqlitedict.SqliteDict(path=":memory:", table="dict", isolation_level="DEFERRED", *args, **kwargs)
  • path is the path to the file where you wish to store the data
  • dict is the table to use in this file
  • isolation_level is the isolation level used for all transactions. See the sqlite documentation for more details.
  • the remaining arguments *args, **kwargs are used to fill the dictionary (like a normal dict)

persistentdicts.kyotocabinetdict.KyotoCabinetDict

persistentdicts.kyotocabinetdict.KyotoCabinetDict(path, *args, **kwargs)
  • path is the path to the file where you wish to store the data. The file extension matters and will determine which format is going to be used internally (must be one of .kch, .kct, .kcd, .kcf or .kcx). See the kyotocabinet documentation for more details.
  • the remaining arguments *args, **kwargs are used to fill the dictionary (like a normal dict)

persistentdicts.cassandradict.CassandraDict

persistentdicts.cassandradict.CassandraDict(contact_points=("127.0.0.1",), port=9042, keyspace="dict", table="dict", *args, **kwargs)
  • contact_points is an initial list of ip addresses which are part of the Cassandra cluster. The Cassandra driver will automatically discover the rest of the cluster.
  • port is the port on which Cassandra runs.
  • keyspace is the keyspace used to store the data. This keyspace will be deleted if the method .delete() is called on the CassandraDict
  • table is the name of the table used to store the data.
  • the remaining arguments *args, **kwargs are used to fill the dictionary (like a normal dict)
Release History

Release History

2.0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
persistentdicts-2.0.4.tar.gz (7.3 kB) Copy SHA256 Checksum SHA256 Source Jan 29, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting