Added metrics for DO (related to #419 and removed for easy merging)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
|
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||||
\echo Use "ALTER EXTENSION cdb_dataservices_server UPDATE TO '0.30.0'" to load this file. \quit
|
\echo Use "ALTER EXTENSION cdb_dataservices_server UPDATE TO '0.30.0'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_apikey(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_apikey(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
orgname TEXT,
|
orgname TEXT,
|
||||||
@@ -31,7 +32,6 @@ RETURNS TEXT AS $$
|
|||||||
return api_key
|
return api_key
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- HERE goes your code to upgrade/downgrade
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_route_with_waypoints(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_route_with_waypoints(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
orgname TEXT,
|
orgname TEXT,
|
||||||
@@ -684,3 +684,133 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options])
|
result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options])
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
geomvals geomval[],
|
||||||
|
params JSON,
|
||||||
|
merge BOOLEAN DEFAULT True)
|
||||||
|
RETURNS TABLE (
|
||||||
|
id INT,
|
||||||
|
data JSON
|
||||||
|
) AS $$
|
||||||
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.metrics import QuotaService
|
||||||
|
from cartodb_services.tools import Logger,LoggerConfig
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||||
|
logger_config = GD["logger_config"]
|
||||||
|
logger = Logger(logger_config)
|
||||||
|
quota_service = QuotaService(user_obs_config, redis_conn)
|
||||||
|
if not quota_service.check_user_quota():
|
||||||
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
|
with metrics('obs_getdata', user_obs_config, logger, params):
|
||||||
|
try:
|
||||||
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4, $5);", ["text", "text", "geomval[]", "json", "boolean"])
|
||||||
|
result = plpy.execute(obs_plan, [username, orgname, geomvals, params, merge])
|
||||||
|
empty_results = len(geomvals) - len(result)
|
||||||
|
if empty_results > 0:
|
||||||
|
quota_service.increment_empty_service_use(empty_results)
|
||||||
|
if result:
|
||||||
|
quota_service.increment_success_service_use(len(result))
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
except BaseException as e:
|
||||||
|
import sys
|
||||||
|
quota_service.increment_failed_service_use(len(geomvals))
|
||||||
|
logger.error('Error trying to OBS_GetData', sys.exc_info(), data={"username": username, "orgname": orgname})
|
||||||
|
raise Exception('Error trying to OBS_GetData')
|
||||||
|
finally:
|
||||||
|
quota_service.increment_total_service_use(len(geomvals))
|
||||||
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
geomrefs TEXT[],
|
||||||
|
params JSON)
|
||||||
|
RETURNS TABLE (
|
||||||
|
id TEXT,
|
||||||
|
data JSON
|
||||||
|
) AS $$
|
||||||
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.metrics import QuotaService
|
||||||
|
from cartodb_services.tools import Logger,LoggerConfig
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||||
|
logger_config = GD["logger_config"]
|
||||||
|
logger = Logger(logger_config)
|
||||||
|
quota_service = QuotaService(user_obs_config, redis_conn)
|
||||||
|
if not quota_service.check_user_quota():
|
||||||
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
|
with metrics('obs_getdata', user_obs_config, logger, params):
|
||||||
|
try:
|
||||||
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4);", ["text", "text", "text[]", "json"])
|
||||||
|
result = plpy.execute(obs_plan, [username, orgname, geomrefs, params])
|
||||||
|
empty_results = len(geomrefs) - len(result)
|
||||||
|
if empty_results > 0:
|
||||||
|
quota_service.increment_empty_service_use(empty_results)
|
||||||
|
if result:
|
||||||
|
quota_service.increment_success_service_use(len(result))
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
except BaseException as e:
|
||||||
|
import sys
|
||||||
|
quota_service.increment_failed_service_use(len(geomrefs))
|
||||||
|
exc_info = sys.exc_info()
|
||||||
|
logger.error('%s, %s, %s' % (exc_info[0], exc_info[1], exc_info[2]))
|
||||||
|
logger.error('Error trying to OBS_GetData', exc_info, data={"username": username, "orgname": orgname})
|
||||||
|
raise Exception('Error trying to OBS_GetData')
|
||||||
|
finally:
|
||||||
|
quota_service.increment_total_service_use(len(geomrefs))
|
||||||
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetMeta(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
geom Geometry(Geometry, 4326),
|
||||||
|
params JSON,
|
||||||
|
max_timespan_rank INTEGER DEFAULT NULL,
|
||||||
|
max_score_rank INTEGER DEFAULT NULL,
|
||||||
|
target_geoms INTEGER DEFAULT NULL)
|
||||||
|
RETURNS JSON AS $$
|
||||||
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.tools import Logger,LoggerConfig
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||||
|
logger_config = GD["logger_config"]
|
||||||
|
logger = Logger(logger_config)
|
||||||
|
|
||||||
|
with metrics('obs_getmeta', user_obs_config, logger, params):
|
||||||
|
try:
|
||||||
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetMeta($1, $2, $3, $4, $5, $6, $7) as meta;", ["text", "text", "Geometry (Geometry, 4326)", "json", "integer", "integer", "integer"])
|
||||||
|
result = plpy.execute(obs_plan, [username, orgname, geom, params, max_timespan_rank, max_score_rank, target_geoms])
|
||||||
|
if result:
|
||||||
|
return result[0]['meta']
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
except BaseException as e:
|
||||||
|
import sys
|
||||||
|
logger.error('Error trying to OBS_GetMeta', sys.exc_info(), data={"username": username, "orgname": orgname})
|
||||||
|
raise Exception('Error trying to OBS_GetMeta')
|
||||||
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|||||||
@@ -269,3 +269,133 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[]);
|
DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[]);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
geomvals geomval[],
|
||||||
|
params JSON,
|
||||||
|
merge BOOLEAN DEFAULT True)
|
||||||
|
RETURNS TABLE (
|
||||||
|
id INT,
|
||||||
|
data JSON
|
||||||
|
) AS $$
|
||||||
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.metrics import QuotaService
|
||||||
|
from cartodb_services.tools import Logger,LoggerConfig
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||||
|
logger_config = GD["logger_config"]
|
||||||
|
logger = Logger(logger_config)
|
||||||
|
quota_service = QuotaService(user_obs_config, redis_conn)
|
||||||
|
if not quota_service.check_user_quota():
|
||||||
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
|
with metrics('obs_getdata', user_obs_config, logger):
|
||||||
|
try:
|
||||||
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4, $5);", ["text", "text", "geomval[]", "json", "boolean"])
|
||||||
|
result = plpy.execute(obs_plan, [username, orgname, geomvals, params, merge])
|
||||||
|
empty_results = len(geomvals) - len(result)
|
||||||
|
if empty_results > 0:
|
||||||
|
quota_service.increment_empty_service_use(empty_results)
|
||||||
|
if result:
|
||||||
|
quota_service.increment_success_service_use(len(result))
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
except BaseException as e:
|
||||||
|
import sys
|
||||||
|
quota_service.increment_failed_service_use(len(geomvals))
|
||||||
|
logger.error('Error trying to OBS_GetData', sys.exc_info(), data={"username": username, "orgname": orgname})
|
||||||
|
raise Exception('Error trying to OBS_GetData')
|
||||||
|
finally:
|
||||||
|
quota_service.increment_total_service_use(len(geomvals))
|
||||||
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
geomrefs TEXT[],
|
||||||
|
params JSON)
|
||||||
|
RETURNS TABLE (
|
||||||
|
id TEXT,
|
||||||
|
data JSON
|
||||||
|
) AS $$
|
||||||
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.metrics import QuotaService
|
||||||
|
from cartodb_services.tools import Logger,LoggerConfig
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||||
|
logger_config = GD["logger_config"]
|
||||||
|
logger = Logger(logger_config)
|
||||||
|
quota_service = QuotaService(user_obs_config, redis_conn)
|
||||||
|
if not quota_service.check_user_quota():
|
||||||
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
|
with metrics('obs_getdata', user_obs_config, logger):
|
||||||
|
try:
|
||||||
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4);", ["text", "text", "text[]", "json"])
|
||||||
|
result = plpy.execute(obs_plan, [username, orgname, geomrefs, params])
|
||||||
|
empty_results = len(geomrefs) - len(result)
|
||||||
|
if empty_results > 0:
|
||||||
|
quota_service.increment_empty_service_use(empty_results)
|
||||||
|
if result:
|
||||||
|
quota_service.increment_success_service_use(len(result))
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
except BaseException as e:
|
||||||
|
import sys
|
||||||
|
quota_service.increment_failed_service_use(len(geomrefs))
|
||||||
|
exc_info = sys.exc_info()
|
||||||
|
logger.error('%s, %s, %s' % (exc_info[0], exc_info[1], exc_info[2]))
|
||||||
|
logger.error('Error trying to OBS_GetData', exc_info, data={"username": username, "orgname": orgname})
|
||||||
|
raise Exception('Error trying to OBS_GetData')
|
||||||
|
finally:
|
||||||
|
quota_service.increment_total_service_use(len(geomrefs))
|
||||||
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetMeta(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
geom Geometry(Geometry, 4326),
|
||||||
|
params JSON,
|
||||||
|
max_timespan_rank INTEGER DEFAULT NULL,
|
||||||
|
max_score_rank INTEGER DEFAULT NULL,
|
||||||
|
target_geoms INTEGER DEFAULT NULL)
|
||||||
|
RETURNS JSON AS $$
|
||||||
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.tools import Logger,LoggerConfig
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||||
|
logger_config = GD["logger_config"]
|
||||||
|
logger = Logger(logger_config)
|
||||||
|
|
||||||
|
with metrics('obs_getmeta', user_obs_config, logger):
|
||||||
|
try:
|
||||||
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetMeta($1, $2, $3, $4, $5, $6, $7) as meta;", ["text", "text", "Geometry (Geometry, 4326)", "json", "integer", "integer", "integer"])
|
||||||
|
result = plpy.execute(obs_plan, [username, orgname, geom, params, max_timespan_rank, max_score_rank, target_geoms])
|
||||||
|
if result:
|
||||||
|
return result[0]['meta']
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
except BaseException as e:
|
||||||
|
import sys
|
||||||
|
logger.error('Error trying to OBS_GetMeta', sys.exc_info(), data={"username": username, "orgname": orgname})
|
||||||
|
raise Exception('Error trying to OBS_GetMeta')
|
||||||
|
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
||||||
|
|||||||
@@ -832,7 +832,7 @@ RETURNS TABLE (
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getdata', user_obs_config, logger):
|
with metrics('obs_getdata', user_obs_config, logger, params):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4, $5);", ["text", "text", "geomval[]", "json", "boolean"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4, $5);", ["text", "text", "geomval[]", "json", "boolean"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geomvals, params, merge])
|
result = plpy.execute(obs_plan, [username, orgname, geomvals, params, merge])
|
||||||
@@ -891,7 +891,7 @@ RETURNS TABLE (
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getdata', user_obs_config, logger):
|
with metrics('obs_getdata', user_obs_config, logger, params):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4);", ["text", "text", "text[]", "json"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4);", ["text", "text", "text[]", "json"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geomrefs, params])
|
result = plpy.execute(obs_plan, [username, orgname, geomrefs, params])
|
||||||
@@ -948,7 +948,7 @@ RETURNS JSON AS $$
|
|||||||
logger_config = GD["logger_config"]
|
logger_config = GD["logger_config"]
|
||||||
logger = Logger(logger_config)
|
logger = Logger(logger_config)
|
||||||
|
|
||||||
with metrics('obs_getmeta', user_obs_config, logger):
|
with metrics('obs_getmeta', user_obs_config, logger, params):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetMeta($1, $2, $3, $4, $5, $6, $7) as meta;", ["text", "text", "Geometry (Geometry, 4326)", "json", "integer", "integer", "integer"])
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetMeta($1, $2, $3, $4, $5, $6, $7) as meta;", ["text", "text", "Geometry (Geometry, 4326)", "json", "integer", "integer", "integer"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, params, max_timespan_rank, max_score_rank, target_geoms])
|
result = plpy.execute(obs_plan, [username, orgname, geom, params, max_timespan_rank, max_score_rank, target_geoms])
|
||||||
@@ -1802,7 +1802,6 @@ RETURNS TEXT AS $$
|
|||||||
|
|
||||||
return api_key
|
return api_key
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
DO $$
|
DO $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN
|
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ RETURNS TABLE (
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getdata', user_obs_config, logger):
|
with metrics('obs_getdata', user_obs_config, logger, params):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4, $5);", ["text", "text", "geomval[]", "json", "boolean"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4, $5);", ["text", "text", "geomval[]", "json", "boolean"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geomvals, params, merge])
|
result = plpy.execute(obs_plan, [username, orgname, geomvals, params, merge])
|
||||||
@@ -667,7 +667,7 @@ RETURNS TABLE (
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getdata', user_obs_config, logger):
|
with metrics('obs_getdata', user_obs_config, logger, params):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4);", ["text", "text", "text[]", "json"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetData($1, $2, $3, $4);", ["text", "text", "text[]", "json"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geomrefs, params])
|
result = plpy.execute(obs_plan, [username, orgname, geomrefs, params])
|
||||||
@@ -724,7 +724,7 @@ RETURNS JSON AS $$
|
|||||||
logger_config = GD["logger_config"]
|
logger_config = GD["logger_config"]
|
||||||
logger = Logger(logger_config)
|
logger = Logger(logger_config)
|
||||||
|
|
||||||
with metrics('obs_getmeta', user_obs_config, logger):
|
with metrics('obs_getmeta', user_obs_config, logger, params):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetMeta($1, $2, $3, $4, $5, $6, $7) as meta;", ["text", "text", "Geometry (Geometry, 4326)", "json", "integer", "integer", "integer"])
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetMeta($1, $2, $3, $4, $5, $6, $7) as meta;", ["text", "text", "Geometry (Geometry, 4326)", "json", "integer", "integer", "integer"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, params, max_timespan_rank, max_score_rank, target_geoms])
|
result = plpy.execute(obs_plan, [username, orgname, geom, params, max_timespan_rank, max_score_rank, target_geoms])
|
||||||
|
|||||||
Reference in New Issue
Block a user