Remove obs_snapshot_config
This commit is contained in:
parent
44da876b4c
commit
fba933cc88
@ -2,4 +2,5 @@
|
|||||||
-- 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.33.0'" to load this file. \quit
|
\echo Use "ALTER EXTENSION cdb_dataservices_server UPDATE TO '0.33.0'" to load this file. \quit
|
||||||
|
|
||||||
-- HERE goes your code to upgrade/downgrade
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_server._get_obs_snapshot_config;
|
||||||
|
@ -2,4 +2,17 @@
|
|||||||
-- 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.32.0'" to load this file. \quit
|
\echo Use "ALTER EXTENSION cdb_dataservices_server UPDATE TO '0.32.0'" to load this file. \quit
|
||||||
|
|
||||||
-- HERE goes your code to upgrade/downgrade
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_snapshot_config(username text, orgname text)
|
||||||
|
RETURNS boolean AS $$
|
||||||
|
cache_key = "user_obs_snapshot_config_{0}".format(username)
|
||||||
|
if cache_key in GD:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
from cartodb_services.metrics import ObservatorySnapshotConfig
|
||||||
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metadata_connection']
|
||||||
|
obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname)
|
||||||
|
GD[cache_key] = obs_snapshot_config
|
||||||
|
return True
|
||||||
|
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -90,20 +90,6 @@ RETURNS boolean AS $$
|
|||||||
return True
|
return True
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER;
|
$$ LANGUAGE plpythonu SECURITY DEFINER;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_snapshot_config(username text, orgname text)
|
|
||||||
RETURNS boolean AS $$
|
|
||||||
cache_key = "user_obs_snapshot_config_{0}".format(username)
|
|
||||||
if cache_key in GD:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
from cartodb_services.metrics import ObservatorySnapshotConfig
|
|
||||||
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
|
||||||
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metadata_connection']
|
|
||||||
obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname)
|
|
||||||
GD[cache_key] = obs_snapshot_config
|
|
||||||
return True
|
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text)
|
||||||
RETURNS boolean AS $$
|
RETURNS boolean AS $$
|
||||||
cache_key = "user_obs_config_{0}".format(username)
|
cache_key = "user_obs_config_{0}".format(username)
|
||||||
|
Loading…
Reference in New Issue
Block a user