X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fdbbase.py;fp=osm_nbi%2Fdbbase.py;h=b101cb433ca73c61a870e8b8b2b2cb15d590a639;hp=0000000000000000000000000000000000000000;hb=c94c3df90aa64298a7935a80b221f80f3c043260;hpb=22ed16460edb54806e9b957be18cbafb2f63b54d diff --git a/osm_nbi/dbbase.py b/osm_nbi/dbbase.py new file mode 100644 index 0000000..b101cb4 --- /dev/null +++ b/osm_nbi/dbbase.py @@ -0,0 +1,38 @@ +from http import HTTPStatus + +__author__ = "Alfonso Tierno " + + +class DbException(Exception): + + def __init__(self, message, http_code=HTTPStatus.NOT_FOUND): + # TODO change to http.HTTPStatus instead of int that allows .value and .name + self.http_code = http_code + Exception.__init__(self, "database exception " + message) + + +class DbBase(object): + + def __init__(self): + pass + + def db_connect(self, config): + pass + + def db_disconnect(self): + pass + + def get_list(self, table, filter={}): + pass + + def get_one(self, table, filter={}, fail_on_empty=True, fail_on_more=True): + pass + + def create(self, table, indata): + pass + + def del_list(self, table, filter={}): + pass + + def del_one(self, table, filter={}, fail_on_empty=True): + pass