`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}'
```
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}'
```
Release files for dossier.store 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dossier.store-0.5.0.tar.gz | 23.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dossier.store-0.5.0-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 77.5 kB
Release files / dossier.store-0.5.0.tar.gz
| Download URL | dossier.store-0.5.0.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
104504f3792c4ab17aeb65dc222d6206c439c54937d8fa82d237c2fa1e907bd8
|
|
BLAKE2b-256 checksum How to use checksums |
914327e2a5fbaddae9249401da0a3db0d53d967fc5f29793dae769d36c3eb2b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / dossier.store-0.5.0-py2.7.egg
| Download URL | dossier.store-0.5.0-py2.7.egg |
|---|---|
| Size | 54.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
ed9ed4fb38c671fbb045217cfc900090ec8358662f77e06ef60b9d92439d2a93
|
|
BLAKE2b-256 checksum How to use checksums |
0be6cbc6c7d28790667d3fa8fd9bf8db8b03a11eefca775b337664ca03a94726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |