Skip to main content

Feature collection storage for DossierStack

Project description

`dossier.store` is a Python package that provides database storage for
feature collections in DossierStack. It is built on top of `kvlayer`, so
it supports many database backends like PostgreSQL, Accumulo and Redis.
`dossier.store` also provides support for defining basic indexes.


### Installation

`dossier.store` is on PyPI and can be installed with `pip`:

```bash
pip install dossier.store
```

Currently, `dossier.store` requires Python 2.7. It is not yet Python 3
compatible.


### Documentation

API documentation with examples is available as part of the Dossier Stack
documentation:
[http://dossier-stack.readthedocs.org](http://dossier-stack.readthedocs.org#module-dossier.store)


### Basic example

A full working example that uses local memory to store a feature collection:

```python
from dossier.fc import FeatureCollection
from dossier.store import Store
import kvlayer
import yakonfig

yaml = """
kvlayer:
app_name: store
namespace: dossier
storage_type: local
"""
with yakonfig.defaulted_config([kvlayer], yaml=yaml):
store = Store(kvlayer.client())

fc = FeatureCollection({u'NAME': {'Foo': 1, 'Bar': 2}})
store.put([('1', fc)])
print store.get('1')
```


### Example using indexes

Here is another example that demonstrates use of indexing to enable a
poor man's case insensitive search:

```python
fc = dossier.fc.FeatureCollection()
fc[u'NAME'][u'foo'] += 1
fc[u'NAME'][u'bar'] = 42

kvl = kvlayer.client()
store = dossier.store.Store(kvl)

# Index transforms must be defined on every instance of `Store`.
# (The index data is persisted; the transforms themselves are
# ephemeral.)
store.define_index(u'name_casei',
create=feature_index(u'NAME'),
transform=lambda s: s.lower().encode('utf-8'))

store.put('{yourid}', fc) # `put` automatically updates indexes.
assert list(store.index_scan(u'name_casei', 'FoO'))[0] == '{yourid}'
```

Project details


Release history Release notifications

History Node

0.5.1.dev6

History Node

0.5.1.dev5

History Node

0.5.1.dev4

History Node

0.5.1.dev3

History Node

0.5.1.dev1

This version
History Node

0.5.0

History Node

0.4.3.dev39

History Node

0.4.3.dev36

History Node

0.4.3.dev35

History Node

0.4.3.dev34

History Node

0.4.3.dev33

History Node

0.4.3.dev32

History Node

0.4.3.dev31

History Node

0.4.3.dev30

History Node

0.4.3.dev29

History Node

0.4.3.dev26

History Node

0.4.3.dev25

History Node

0.4.2

History Node

0.4.2.dev1

History Node

0.4.1

History Node

0.4.0

History Node

0.3.6.dev2

History Node

0.3.6.dev1

History Node

0.3.5

History Node

0.3.5.dev2

History Node

0.3.5.dev1

History Node

0.3.4

History Node

0.3.3

History Node

0.3.3.dev2

History Node

0.3.3.dev1

History Node

0.3.2

History Node

0.3.2.dev5

History Node

0.3.2.dev4

History Node

0.3.2.dev2

History Node

0.3.2.dev1

History Node

0.2.6.dev5

History Node

0.2.6.dev4

History Node

0.2.6.dev3

History Node

0.2.6.dev2

History Node

0.2.6.dev1

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.1

History Node

0.2.1.dev1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dossier.store-0.5.0-py2.7.egg (54.1 kB) Copy SHA256 hash SHA256 Egg 2.7 Sep 6, 2015
dossier.store-0.5.0.tar.gz (23.4 kB) Copy SHA256 hash SHA256 Source None Sep 6, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page