leveldb-py | LevelDB Python interface using ctypes | Database library
kandi X-RAY | leveldb-py Summary
kandi X-RAY | leveldb-py Summary
LevelDB Python interface using ctypes
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create a new database .
- Seek to the last key in the database .
- Returns the row of the row .
- Create a new db interface scope .
- Construct a MemoryDB interface .
- Put a key into the list .
- Close the object .
- Get an iterator for the data .
- Delete a key from a batch .
- Return the value of the field .
leveldb-py Key Features
leveldb-py Examples and Code Snippets
Community Discussions
Trending Discussions on leveldb-py
QUESTION
There are many solutions to serialize a small dictionary: json.loads
/json.dumps
, pickle
, shelve
, ujson
, or even by using sqlite
.
But when dealing with possibly 100 GB of data, it's not possible anymore to use such modules that would possibly rewrite the whole data when closing / serializing.
redis
is not really an option because it uses a client/server scheme.
Question: Which key:value store, serverless, able to work with 100+ GB of data, are frequently used in Python?
I'm looking for a solution with a standard "Pythonic" d[key] = value
syntax:
ANSWER
Answered 2018-Jan-21 at 12:21I would consider HDF5 for this. It has several advantages:
- Usable from many programming languages.
- Usable from Python via the excellent h5py package.
- Battle tested, including with large data sets.
- Supports variable-length string values.
- Values are addressable by a filesystem-like "path" (
/foo/bar
). - Values can be arrays (and usually are), but do not have to be.
- Optional built-in compression.
- Optional "chunking" to allow writing chunks incrementally.
- Does not require loading the entire data set into memory at once.
It does have some disadvantages too:
- Extremely flexible, to the point of making it hard to define a single approach.
- Complex format, not feasible to use without the official HDF5 C library (but there are many wrappers, e.g.
h5py
). - Baroque C/C++ API (the Python one is not so).
- Little support for concurrent writers (or writer + readers). Writes might need to lock at a coarse granularity.
You can think of HDF5 as a way to store values (scalars or N-dimensional arrays) inside a hierarchy inside a single file (or indeed multiple such files). The biggest problem with just storing your values in a single disk file would be that you'd overwhelm some filesystems; you can think of HDF5 as a filesystem within a file which won't fall down when you put a million values in one "directory."
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install leveldb-py
You can use leveldb-py like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page