OceanDB ElasticSearch Driver (Python)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
oceandb_elasticsearch_driver
tests
.bumpversion.cfg
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
MANIFEST.in
Makefile
README.md
bumpversion.sh
requirements_dev.txt
setup.cfg
setup.py
tox.ini

README.md

banner

oceandb-elasticsearch-driver

🐳 Elasticsearch driver for OceanDB (Python). oceanprotocol.com

Travis (.com) Codacy coverage PyPI GitHub contributors


Table of Contents


Features

Elasticsearch driver to connect implementing OceanDB.

Prerequisites

You should have running a elasticsearch instance.

Quickstart

First of all we have to specify where is allocated our config. To do that we have to pass the following argument:

--config=/path/of/my/config

If you do not provide a configuration path, by default the config is expected in the config folder.

In the configuration we are going to specify the following parameters to

    [oceandb]

    enabled=true            # In order to enable or not the plugin
    module=elasticsearch    # You can use one the plugins already created. Currently we have elasticsearch, mongodb and bigchaindb.
    module.path=            # You can specify the location of your custom plugin.
    db.hostname=localhost   # Address of your Elasticsearch instance.
    db.port=9200            # Port of your Elasticsearch rest API.
    db.username=elastic     # If you are using authentication, elasticsearch username.
    db.password=changeme    # If you are using authentication, elasticsearch password.
    db.index=oceandb        # Elasticsearch index name

Once you have defined this the only thing that you have to do it is use it:

    oceandb = OceanDb(conf)
    oceandb.write({"value": "test"}, id)

Environment variables

When you want to instantiate an Oceandb plugin you can provide the next environment variables:

  • $CONFIG_PATH
  • $MODULE
  • $DB_HOSTNAME
  • $DB_PORT
  • $DB_INDEX
  • $DB_USERNAME
  • $DB_PASSWORD

Code style

The information about code style in python is documented in this two links python-developer-guide and python-style-guide.

Testing

Automatic tests are setup via Travis, executing tox. Our test use pytest framework.

New Version

The bumpversion.sh script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.

License

Copyright 2018 Ocean Protocol Foundation Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.