Mercurial > hg > Feedworm
view BackendFactory.py @ 256:f79be01821c4
Arangodb backend, first version which barely works for reading
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 30 Jan 2019 07:11:10 +0100 |
parents | e34c53a3e407 |
children |
line wrap: on
line source
# -*- coding: utf-8 -*- import argparse ARANGODB_BACKEND = "arangodb" COUCHDB_BACKEND = "couchdb" SQLALCHEMY_BACKEND = "sqlalchemy" def _parseArguments(): parser = argparse.ArgumentParser() parser.add_argument("--backend", nargs="?", choices=[ARANGODB_BACKEND, COUCHDB_BACKEND, SQLALCHEMY_BACKEND], required=True, help="Specify the backend to use: either arangodb, couchdb or sqlalchemy") return parser.parse_known_args() def createBackend(): args = _parseArguments() backend = args[0].backend if backend == SQLALCHEMY_BACKEND: from backend.sqlalchemy.SqlAlchemyBackend import SqlAlchemyBackend return SqlAlchemyBackend() elif backend == COUCHDB_BACKEND: from backend.couchdb.CouchDbBackend import CouchDbBackend return CouchDbBackend() elif backend == ARANGODB_BACKEND: from backend.arangodb.ArangoBackend import ArangoBackend return ArangoBackend() else: raise Exception("no backend configured")