skip to navigation
skip to content

unqlite 0.1.0

Python bindings for UnQLite, the embedded NoSQL database.

Latest Version: 0.4.1


Python bindings for [UnQLite](, a lightweight, embedded NoSQL database and JSON document store.

UnQLite features:

* Embedded, zero-conf database
* Transactional (ACID)
* Single file or in-memory database
* Key/value store
* Cursor support and linear record traversal
* JSON document store
* Thread-safe
* Terabyte-sized databases


* [unqlite-python documentation](
* [UnQLite's C API](

## Installation

You can install unqlite using `pip`.

pip install unqlite

## Basic usage

First you instantiate an `UnQLite` object, passing in either the path to the database file or the special string `':mem:'` for an in-memory database.

Below is a sample interactive console session designed to show some of the basic features and functionality of the unqlite-python library. Also check out the [full API documentation](

To begin, instantiate an ``UnQLite`` object. You can specify either the path to a database file, or use UnQLite as an in-memory database.

>>> from unqlite import UnQLite
>>> db = UnQLite() # Create an in-memory database.

### Key/value features

UnQLite can be used as a key/value store.

>>> db['foo'] = 'bar' # Use as a key/value store.
>>> print db['foo']

>>> for i in range(4):
... db['k%s' % i] = str(i)

>>> 'k3' in db
>>> 'k4' in db
>>> del db['k3']

>>> db.append('k2', 'XXXX')
>>> db['k2']

You can also use cursors to traverse the database in key-order:

>>> with db.cursor() as cursor:
... for key, value in cursor:
... print key, '=>', value
foo => bar
k0 => 0
k1 => 1
k2 => 2XXXX

There are many different ways of interacting with cursors, which are described in the [Cursor API documentation](

### Document store features

UnQLite can be used as a JSON document store. The [Jx9 scripting language]( is used to interact with the document store.

>>> script = """
... db_create('users');
... db_store('users', $list_of_users);
... $users_from_db = db_fetch_all('users');
... """

>>> list_of_users = [
... {'username': 'Huey', 'age': 3},
... {'username': 'Mickey', 'age': 5}
... ]

>>> with db.compile_script(script) as vm:
... vm['list_of_users'] = list_of_users
... vm.execute()
... users_from_db = vm['users_from_db']

>>> users_from_db # UnQLite assigns items in a collection an ID.
[{'username': 'Huey', 'age': 3, '__id': 0},
{'username': 'Mickey', 'age': 5, '__id': 1}]

More information can be found in the [VM API documentation](


This code is based in part on nobonobo's [unqlitepy]( library.
File Type Py Version Uploaded on Size
unqlite-0.1.0.tar.gz (md5) Source 2014-06-26 507KB
  • Downloads (All Versions):
  • 47 downloads in the last day
  • 304 downloads in the last week
  • 1187 downloads in the last month