aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/calls.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/db/calls.py')
-rw-r--r--gn3/db/calls.py51
1 files changed, 0 insertions, 51 deletions
diff --git a/gn3/db/calls.py b/gn3/db/calls.py
deleted file mode 100644
index 547bccf..0000000
--- a/gn3/db/calls.py
+++ /dev/null
@@ -1,51 +0,0 @@
-"""module contains calls method for db"""
-import json
-import urllib
-from flask import g
-from gn3.utility.logger import getLogger
-logger = getLogger(__name__)
-# should probably put this is env
-USE_GN_SERVER = False
-LOG_SQL = False
-
-GN_SERVER_URL = None
-
-
-def fetch1(query, path=None, func=None):
- """fetch1 method"""
- if USE_GN_SERVER and path:
- result = gn_server(path)
- if func is not None:
- res2 = func(result)
-
- else:
- res2 = result
-
- if LOG_SQL:
- pass
- # should probably and logger
- # logger.debug("Replaced SQL call", query)
-
- # logger.debug(path,res2)
- return res2
-
- return fetchone(query)
-
-
-def gn_server(path):
- """Return JSON record by calling GN_SERVER
-
- """
- res = urllib.request.urlopen(GN_SERVER_URL+path)
- rest = res.read()
- res2 = json.loads(rest)
- return res2
-
-
-def fetchone(query):
- """method to fetchone item from db"""
- def helper(query):
- res = g.db.execute(query)
- return res.fetchone()
-
- return logger.sql(query, helper)