commit
aad5044a1f
@ -12,7 +12,13 @@ CREATE TYPE cdb_dataservices_client.obs_meta_denominator AS (denom_id text, deno
|
||||
CREATE TYPE cdb_dataservices_client.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean, score numeric, numtiles bigint, notnull_percent numeric, numgeoms numeric, percentfill numeric, estnumgeoms numeric, meanmediansize numeric, geom_type text, geom_extra jsonb, geom_tags jsonb);
|
||||
CREATE TYPE cdb_dataservices_client.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean, timespan_type text, timespan_extra jsonb, timespan_tags jsonb);
|
||||
|
||||
ALTER TYPE cdb_dataservices_client.service_type ADD VALUE 'observatory' AFTER 'routing';
|
||||
WITH c AS (
|
||||
SELECT pg_type.oid as id
|
||||
FROM pg_type INNER JOIN pg_namespace ON (pg_type.typnamespace = pg_namespace.oid)
|
||||
WHERE pg_type.typname = 'service_type' AND pg_namespace.nspname = 'cdb_dataservices_client'
|
||||
)
|
||||
INSERT INTO pg_enum (enumtypid, enumsortorder, enumlabel)
|
||||
SELECT c.id, 4, 'observatory' FROM c;
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_get_demographic_snapshot (geom public.geometry(Geometry, 4326) ,time_span text DEFAULT '2009 - 2013'::text ,geometry_level text DEFAULT NULL)
|
||||
RETURNS json AS $$
|
||||
|
@ -65,6 +65,13 @@ DROP FUNCTION IF EXISTS cdb_dataservices_server.OBS_LegacyBuilderMetadata(TEXT,
|
||||
DROP FUNCTION IF EXISTS cdb_dataservices_server._OBS_GetNumerators (TEXT, TEXT, geometry(Geometry, 4326), TEXT[], TEXT[] , TEXT[], TEXT[] , TEXT, TEXT, TEXT, TEXT);
|
||||
DROP FUNCTION IF EXISTS cdb_dataservices_server._get_obs_config(TEXT, TEXT);
|
||||
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_numerator;
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_denominator;
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_geometry;
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_timespan;
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.ds_fdw_metadata;
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.ds_return_metadata;
|
||||
|
||||
DELETE FROM pg_enum
|
||||
WHERE enumlabel = 'observatory'
|
||||
AND enumtypid = (
|
||||
@ -122,17 +129,5 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$
|
||||
provider = user_routing_config.provider
|
||||
ret += [[service, monthly_quota, used_quota, soft_limit, provider]]
|
||||
|
||||
#-- Observatory
|
||||
service = 'observatory'
|
||||
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)]
|
||||
user_service = UserMetricsService(user_obs_config, redis_conn)
|
||||
|
||||
monthly_quota = user_obs_config.monthly_quota
|
||||
used_quota = user_service.used_quota(user_obs_config.service_type, today)
|
||||
soft_limit = user_obs_config.soft_limit
|
||||
provider = user_obs_config.provider
|
||||
ret += [[service, monthly_quota, used_quota, soft_limit, provider]]
|
||||
|
||||
return ret
|
||||
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||
|
@ -1446,7 +1446,13 @@ RETURNS boolean AS $$
|
||||
return True
|
||||
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||
|
||||
ALTER TYPE cdb_dataservices_server.service_type ADD VALUE 'observatory' AFTER 'routing';
|
||||
WITH c AS (
|
||||
SELECT pg_type.oid as id
|
||||
FROM pg_type INNER JOIN pg_namespace ON (pg_type.typnamespace = pg_namespace.oid)
|
||||
WHERE pg_type.typname = 'service_type' AND pg_namespace.nspname = 'cdb_dataservices_server'
|
||||
)
|
||||
INSERT INTO pg_enum (enumtypid, enumsortorder, enumlabel)
|
||||
SELECT c.id, 4, 'observatory' FROM c;
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info(
|
||||
username TEXT,
|
||||
|
Loading…
Reference in New Issue
Block a user