From 35ff75ea64726e3d8fbedb9f3d7701de104bf926 Mon Sep 17 00:00:00 2001 From: manmorjim Date: Mon, 9 Mar 2020 13:02:26 +0100 Subject: [PATCH 1/5] Replace `@@plpythonu@@` vars in old_versions --- server/extension/Makefile | 9 +- ...db_dataservices_server--0.36.0--0.37.0.sql | 4 +- ...db_dataservices_server--0.37.0--0.36.0.sql | 4 +- .../cdb_dataservices_server--0.37.0.sql | 182 +++++++++--------- .../cdb_dataservices_server.control.in | 2 +- .../cdb_dataservices_server--0.0.1--0.1.0.sql | 4 +- .../cdb_dataservices_server--0.1.0--0.2.0.sql | 4 +- .../cdb_dataservices_server--0.1.0.sql | 4 +- ...db_dataservices_server--0.10.0--0.11.0.sql | 2 +- .../cdb_dataservices_server--0.10.0.sql | 18 +- ...db_dataservices_server--0.11.0--0.12.0.sql | 4 +- .../cdb_dataservices_server--0.11.0.sql | 20 +- ...db_dataservices_server--0.12.0--0.13.0.sql | 2 +- .../cdb_dataservices_server--0.12.0.sql | 24 +-- ...db_dataservices_server--0.13.0--0.12.0.sql | 2 +- .../cdb_dataservices_server--0.13.0.sql | 24 +-- .../cdb_dataservices_server--0.13.1.sql | 24 +-- ...db_dataservices_server--0.13.2--0.13.3.sql | 2 +- .../cdb_dataservices_server--0.13.2.sql | 24 +-- ...db_dataservices_server--0.13.3--0.13.2.sql | 6 +- ...db_dataservices_server--0.13.3.1--0.14.sql | 8 +- .../cdb_dataservices_server--0.13.3.1.sql | 20 +- .../cdb_dataservices_server--0.13.3.sql | 20 +- ...db_dataservices_server--0.14--0.13.3.1.sql | 6 +- .../cdb_dataservices_server--0.14--0.14.1.sql | 2 +- .../cdb_dataservices_server--0.14.1--0.14.sql | 2 +- .../cdb_dataservices_server--0.14.1.sql | 22 +-- ...db_dataservices_server--0.14.2--0.15.0.sql | 2 +- .../cdb_dataservices_server--0.14.2.sql | 22 +-- .../cdb_dataservices_server--0.14.sql | 22 +-- ...db_dataservices_server--0.15.0--0.14.2.sql | 2 +- .../cdb_dataservices_server--0.15.1.sql | 22 +-- .../cdb_dataservices_server--0.16.0.sql | 22 +-- .../cdb_dataservices_server--0.17.0.sql | 22 +-- .../cdb_dataservices_server--0.18.0.sql | 22 +-- .../cdb_dataservices_server--0.18.1.sql | 22 +-- ...db_dataservices_server--0.19.0--0.20.0.sql | 4 +- .../cdb_dataservices_server--0.19.0.sql | 22 +-- .../cdb_dataservices_server--0.2.0--0.1.0.sql | 4 +- .../cdb_dataservices_server--0.2.0.sql | 4 +- ...db_dataservices_server--0.20.0--0.19.0.sql | 2 +- .../cdb_dataservices_server--0.20.0.sql | 24 +-- ...db_dataservices_server--0.21.0--0.22.0.sql | 6 +- .../cdb_dataservices_server--0.21.0.sql | 24 +-- ...db_dataservices_server--0.22.0--0.21.0.sql | 6 +- .../cdb_dataservices_server--0.22.0.sql | 24 +-- .../cdb_dataservices_server--0.23.0.sql | 24 +-- .../cdb_dataservices_server--0.24.0.sql | 24 +-- .../cdb_dataservices_server--0.24.1.sql | 24 +-- .../cdb_dataservices_server--0.24.2.sql | 24 +-- .../cdb_dataservices_server--0.25.0.sql | 24 +-- .../cdb_dataservices_server--0.26.0.sql | 24 +-- .../cdb_dataservices_server--0.27.0.sql | 24 +-- ...db_dataservices_server--0.28.0--0.29.0.sql | 140 +++++++------- .../cdb_dataservices_server--0.28.0.sql | 24 +-- ...db_dataservices_server--0.29.0--0.28.0.sql | 24 +-- ...db_dataservices_server--0.29.0--0.30.0.sql | 38 ++-- .../cdb_dataservices_server--0.29.0.sql | 140 +++++++------- .../cdb_dataservices_server--0.3.0--0.4.0.sql | 4 +- .../cdb_dataservices_server--0.3.0.sql | 4 +- ...db_dataservices_server--0.30.0--0.29.0.sql | 26 +-- ...db_dataservices_server--0.30.0--0.30.1.sql | 2 +- .../cdb_dataservices_server--0.30.0.sql | 152 +++++++-------- ...db_dataservices_server--0.30.1--0.30.0.sql | 2 +- ...db_dataservices_server--0.30.1--0.30.2.sql | 8 +- .../cdb_dataservices_server--0.30.1.sql | 152 +++++++-------- ...db_dataservices_server--0.30.2--0.30.1.sql | 6 +- ...db_dataservices_server--0.30.2--0.30.3.sql | 2 +- .../cdb_dataservices_server--0.30.2.sql | 152 +++++++-------- ...db_dataservices_server--0.30.3--0.30.2.sql | 2 +- ...db_dataservices_server--0.30.3--0.30.4.sql | 2 +- .../cdb_dataservices_server--0.30.3.sql | 152 +++++++-------- ...db_dataservices_server--0.30.4--0.30.3.sql | 2 +- ...db_dataservices_server--0.30.4--0.30.5.sql | 2 +- .../cdb_dataservices_server--0.30.4.sql | 152 +++++++-------- ...db_dataservices_server--0.30.5--0.30.4.sql | 2 +- ...db_dataservices_server--0.30.5--0.31.0.sql | 24 +-- .../cdb_dataservices_server--0.30.5.sql | 152 +++++++-------- ...db_dataservices_server--0.31.0--0.30.5.sql | 10 +- ...db_dataservices_server--0.31.0--0.32.0.sql | 12 +- .../cdb_dataservices_server--0.31.0.sql | 166 ++++++++-------- ...db_dataservices_server--0.32.0--0.33.0.sql | 10 +- .../cdb_dataservices_server--0.32.0.sql | 178 ++++++++--------- ...db_dataservices_server--0.33.0--0.32.0.sql | 12 +- ...db_dataservices_server--0.33.0--0.34.0.sql | 22 +-- .../cdb_dataservices_server--0.33.0.sql | 178 ++++++++--------- ...db_dataservices_server--0.34.0--0.33.0.sql | 22 +-- ...db_dataservices_server--0.34.0--0.34.1.sql | 6 +- .../cdb_dataservices_server--0.34.0.sql | 176 ++++++++--------- ...db_dataservices_server--0.34.1--0.34.0.sql | 6 +- ...db_dataservices_server--0.34.1--0.34.2.sql | 2 +- .../cdb_dataservices_server--0.34.1.sql | 176 ++++++++--------- ...db_dataservices_server--0.34.2--0.34.1.sql | 2 +- ...db_dataservices_server--0.34.2--0.35.0.sql | 8 +- .../cdb_dataservices_server--0.34.2.sql | 176 ++++++++--------- ...db_dataservices_server--0.35.0--0.34.2.sql | 8 +- .../cdb_dataservices_server--0.35.0.sql | 176 ++++++++--------- ...db_dataservices_server--0.35.1--0.36.0.sql | 12 +- .../cdb_dataservices_server--0.35.1.sql | 176 ++++++++--------- ...db_dataservices_server--0.36.0--0.35.1.sql | 4 +- .../cdb_dataservices_server--0.36.0.sql | 182 +++++++++--------- .../cdb_dataservices_server--0.4.0--0.5.0.sql | 6 +- .../cdb_dataservices_server--0.4.0.sql | 8 +- .../cdb_dataservices_server--0.5.0--0.4.0.sql | 2 +- .../cdb_dataservices_server--0.5.0--0.5.1.sql | 14 +- .../cdb_dataservices_server--0.5.0.sql | 12 +- .../cdb_dataservices_server--0.5.1--0.5.0.sql | 12 +- .../cdb_dataservices_server--0.5.1--0.5.2.sql | 2 +- .../cdb_dataservices_server--0.5.1.sql | 14 +- .../cdb_dataservices_server--0.5.2--0.5.1.sql | 2 +- .../cdb_dataservices_server--0.5.2.sql | 14 +- .../cdb_dataservices_server--0.6.0.sql | 14 +- .../cdb_dataservices_server--0.6.1--0.6.2.sql | 2 +- .../cdb_dataservices_server--0.6.1.sql | 14 +- .../cdb_dataservices_server--0.6.2--0.6.1.sql | 2 +- .../cdb_dataservices_server--0.6.2--0.7.0.sql | 2 +- .../cdb_dataservices_server--0.6.2.sql | 14 +- .../cdb_dataservices_server--0.7.0--0.7.1.sql | 2 +- .../cdb_dataservices_server--0.7.0.sql | 16 +- .../cdb_dataservices_server--0.7.1--0.7.0.sql | 2 +- .../cdb_dataservices_server--0.7.1.sql | 16 +- .../cdb_dataservices_server--0.7.2.sql | 16 +- .../cdb_dataservices_server--0.7.3--0.7.4.sql | 2 +- .../cdb_dataservices_server--0.7.3.sql | 16 +- .../cdb_dataservices_server--0.7.4--0.7.3.sql | 2 +- .../cdb_dataservices_server--0.7.4--0.8.0.sql | 2 +- .../cdb_dataservices_server--0.7.4.sql | 16 +- .../cdb_dataservices_server--0.8.0--0.9.0.sql | 2 +- .../cdb_dataservices_server--0.8.0.sql | 18 +- .../cdb_dataservices_server--0.9.0--0.8.0.sql | 2 +- .../cdb_dataservices_server--0.9.0.sql | 18 +- 131 files changed, 2124 insertions(+), 2117 deletions(-) diff --git a/server/extension/Makefile b/server/extension/Makefile index f160612..b17845a 100644 --- a/server/extension/Makefile +++ b/server/extension/Makefile @@ -70,7 +70,7 @@ release: replace_variables $(EXTENSION).control $(SOURCES_DATA) git mv *.sql old_versions $(SED) $(REPLACEMENTS) $(EXTENSION).control.in > $(EXTENSION).control git add $(EXTENSION).control - cat $(SOURCES_DATA_DIR_OUT)/*.sql > $(EXTENSION)--$(NEW_VERSION).sql + cat $(SOURCES_DATA_DIR)/*.sql > $(EXTENSION)--$(NEW_VERSION).sql $(ERB) version=$(NEW_VERSION) upgrade_downgrade_template.erb > $(EXTENSION)--$(EXTVERSION)--$(NEW_VERSION).sql $(ERB) version=$(EXTVERSION) upgrade_downgrade_template.erb > $(EXTENSION)--$(NEW_VERSION)--$(EXTVERSION).sql git add $(EXTENSION)--$(NEW_VERSION).sql @@ -86,6 +86,9 @@ devclean: rm -rf $(TEST_DIR) rm -rf $(SOURCES_DATA_DIR_OUT) rm -rf $(EXTENSION).control + for f in $(basename $(wildcard old_versions/*.bak)); do \ + mv $${f}.bak $${f}; \ + done # If needed remove PARALLEL tags from the release files release_remove_parallel_deploy: @@ -125,6 +128,10 @@ replace_variables: sed -e 's/@@plpythonu@@/$(PLPYTHONU)/g' \ > $(SOURCES_DATA_DIR_OUT)/$${f}; \ done + for f in $(basename $(wildcard old_versions/*.bak)); do \ + mv $${f}.bak $${f}; \ + sed --in-place=.bak -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ + done install: deploy diff --git a/server/extension/cdb_dataservices_server--0.36.0--0.37.0.sql b/server/extension/cdb_dataservices_server--0.36.0--0.37.0.sql index 43609ac..f8e1028 100644 --- a/server/extension/cdb_dataservices_server--0.36.0--0.37.0.sql +++ b/server/extension/cdb_dataservices_server--0.36.0--0.37.0.sql @@ -65,7 +65,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE@@plpythonu@@SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -123,4 +123,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE@@plpythonu@@SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/cdb_dataservices_server--0.37.0--0.36.0.sql b/server/extension/cdb_dataservices_server--0.37.0--0.36.0.sql index 3124830..47bd18e 100644 --- a/server/extension/cdb_dataservices_server--0.37.0--0.36.0.sql +++ b/server/extension/cdb_dataservices_server--0.37.0--0.36.0.sql @@ -66,7 +66,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE@@plpythonu@@SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( @@ -126,4 +126,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE@@plpythonu@@SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/cdb_dataservices_server--0.37.0.sql b/server/extension/cdb_dataservices_server--0.37.0.sql index b8fb460..7f46089 100644 --- a/server/extension/cdb_dataservices_server--0.37.0.sql +++ b/server/extension/cdb_dataservices_server--0.37.0.sql @@ -72,7 +72,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -140,7 +140,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -201,7 +201,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -241,7 +241,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -280,7 +280,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -298,7 +298,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -315,7 +315,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -369,7 +369,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -426,7 +426,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -478,7 +478,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -533,7 +533,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -590,7 +590,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -645,7 +645,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -702,7 +702,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -757,7 +757,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -812,7 +812,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -867,7 +867,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -928,7 +928,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -989,7 +989,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1037,7 +1037,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1083,7 +1083,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1141,7 +1141,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1199,7 +1199,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1251,7 +1251,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1304,7 +1304,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1357,7 +1357,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1417,7 +1417,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1479,7 +1479,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1539,7 +1539,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1601,7 +1601,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1612,7 +1612,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1741,7 +1741,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1779,7 +1779,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1793,7 +1793,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1807,7 +1807,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1821,7 +1821,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1835,7 +1835,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1944,7 +1944,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1974,7 +1974,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2029,7 +2029,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2045,7 +2045,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2060,7 +2060,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2073,7 +2073,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2086,7 +2086,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2099,7 +2099,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocodio_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2112,7 +2112,7 @@ RETURNS Geometry AS $$ geocodio_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_geocodio_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(geocodio_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2145,7 +2145,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2177,7 +2177,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2218,7 +2218,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2264,7 +2264,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2310,7 +2310,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_geocodio_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2356,7 +2356,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Geocodio') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2375,7 +2375,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2399,7 +2399,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2423,7 +2423,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2447,7 +2447,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2490,7 +2490,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2501,7 +2501,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2512,7 +2512,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2529,7 +2529,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2546,7 +2546,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_geocodio_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2563,7 +2563,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', GeocodioGeocoderConfigBuilder, username, orgname, GD) geocoder = GeocodioBulkGeocoder(service_manager.config.geocodio_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2601,7 +2601,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2660,7 +2660,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2698,7 +2698,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2771,7 +2771,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2791,7 +2791,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2811,7 +2811,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2856,7 +2856,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2963,7 +2963,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3005,7 +3005,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3047,7 +3047,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3090,7 +3090,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3229,7 +3229,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3318,7 +3318,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3384,7 +3384,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3448,7 +3448,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3512,7 +3512,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3573,7 +3573,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3631,7 +3631,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3689,7 +3689,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3723,7 +3723,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3738,7 +3738,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3752,7 +3752,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3766,7 +3766,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3780,7 +3780,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3814,7 +3814,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3829,7 +3829,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3842,7 +3842,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3855,7 +3855,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3868,7 +3868,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/cdb_dataservices_server.control.in b/server/extension/cdb_dataservices_server.control.in index c0d362e..3e18400 100644 --- a/server/extension/cdb_dataservices_server.control.in +++ b/server/extension/cdb_dataservices_server.control.in @@ -1,5 +1,5 @@ comment = 'CartoDB dataservices server extension' -default_version = '0.38.0' +default_version = '0.37.0' requires = '@@plpythonu@@, plproxy, postgis, cdb_geocoder' superuser = true schema = cdb_dataservices_server diff --git a/server/extension/old_versions/cdb_dataservices_server--0.0.1--0.1.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.0.1--0.1.0.sql index 272931d..7dd9f95 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.0.1--0.1.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.0.1--0.1.0.sql @@ -46,7 +46,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) @@ -72,7 +72,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_geocode_street_point(TEXT, TEXT, TEXT, TEXT); diff --git a/server/extension/old_versions/cdb_dataservices_server--0.1.0--0.2.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.1.0--0.2.0.sql index a4f2997..b2e71b7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.1.0--0.2.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.1.0--0.2.0.sql @@ -22,7 +22,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) @@ -53,7 +53,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.1.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.1.0.sql index c55335c..0c173f7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.1.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.1.0.sql @@ -56,7 +56,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -81,7 +81,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.10.0--0.11.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.10.0--0.11.0.sql index 4ac7c63..d5232b5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.10.0--0.11.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.10.0--0.11.0.sql @@ -98,4 +98,4 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.10.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.10.0.sql index 9992b5c..1056fb3 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.10.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.10.0.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1143,7 +1143,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1157,7 +1157,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1171,7 +1171,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1185,7 +1185,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1199,7 +1199,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1213,7 +1213,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2016,7 +2016,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.11.0--0.12.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.11.0--0.12.0.sql index d09ba67..21702c1 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.11.0--0.12.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.11.0--0.12.0.sql @@ -71,7 +71,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; @@ -130,4 +130,4 @@ RETURNS boolean AS $$ mapzen_isolines_config = MapzenIsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_isolines_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.11.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.11.0.sql index f9937be..4a1786a 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.11.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.11.0.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1143,7 +1143,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1157,7 +1157,7 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1171,7 +1171,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1185,7 +1185,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1199,7 +1199,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1213,7 +1213,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1227,7 +1227,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2074,7 +2074,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.12.0--0.13.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.12.0--0.13.0.sql index ba7cf27..f096be6 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.12.0--0.13.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.12.0--0.13.0.sql @@ -111,7 +111,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.12.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.12.0.sql index b26ceef..fac6151 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.12.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.12.0.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1143,7 +1143,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1157,7 +1157,7 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_isolines_config(username text, orgname text) RETURNS boolean AS $$ @@ -1171,7 +1171,7 @@ RETURNS boolean AS $$ mapzen_isolines_config = MapzenIsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_isolines_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1185,7 +1185,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1199,7 +1199,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1213,7 +1213,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1227,7 +1227,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1241,7 +1241,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2088,7 +2088,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2159,7 +2159,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.0--0.12.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.0--0.12.0.sql index 33bdc46..b31ab93 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.0--0.12.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.0--0.12.0.sql @@ -120,5 +120,5 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.0.sql index de79e50..8a0b8a2 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.0.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1183,7 +1183,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1197,7 +1197,7 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_isolines_config(username text, orgname text) RETURNS boolean AS $$ @@ -1211,7 +1211,7 @@ RETURNS boolean AS $$ mapzen_isolines_config = MapzenIsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_isolines_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1225,7 +1225,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1239,7 +1239,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1253,7 +1253,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1267,7 +1267,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1281,7 +1281,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2128,7 +2128,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2202,7 +2202,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.1.sql index 29ec164..f8af2b6 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.1.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1184,7 +1184,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1198,7 +1198,7 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_isolines_config(username text, orgname text) RETURNS boolean AS $$ @@ -1212,7 +1212,7 @@ RETURNS boolean AS $$ mapzen_isolines_config = MapzenIsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_isolines_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1226,7 +1226,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1240,7 +1240,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1254,7 +1254,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1268,7 +1268,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1282,7 +1282,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2129,7 +2129,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2203,7 +2203,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.2--0.13.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.2--0.13.3.sql index 0d7fa1d..999a98c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.2--0.13.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.2--0.13.3.sql @@ -237,4 +237,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.2.sql index e1a6de7..841c481 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.2.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1184,7 +1184,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1198,7 +1198,7 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_isolines_config(username text, orgname text) RETURNS boolean AS $$ @@ -1212,7 +1212,7 @@ RETURNS boolean AS $$ mapzen_isolines_config = MapzenIsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_isolines_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1226,7 +1226,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1240,7 +1240,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1254,7 +1254,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1268,7 +1268,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1282,7 +1282,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2129,7 +2129,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2203,7 +2203,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.3--0.13.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.3--0.13.2.sql index ece562c..f5faf47 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.3--0.13.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.3--0.13.2.sql @@ -15,7 +15,7 @@ RETURNS boolean AS $$ mapzen_geocoder_config = MapzenGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_mapzen_isolines_config(username text, orgname text) RETURNS boolean AS $$ @@ -29,7 +29,7 @@ RETURNS boolean AS $$ mapzen_isolines_config = MapzenIsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = mapzen_isolines_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -220,4 +220,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.3.1--0.14.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.3.1--0.14.sql index 3dc6a05..4513c61 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.3.1--0.14.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.3.1--0.14.sql @@ -13,7 +13,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -668,7 +668,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( username TEXT, @@ -741,7 +741,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -802,7 +802,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to get mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- DO diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.3.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.3.1.sql index 904e09b..ad628ea 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.3.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.3.1.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1184,7 +1184,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1198,7 +1198,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1212,7 +1212,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1226,7 +1226,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1240,7 +1240,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1254,7 +1254,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2104,7 +2104,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2178,7 +2178,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.13.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.13.3.sql index 5c847f6..d580a5f 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.13.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.13.3.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1184,7 +1184,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1198,7 +1198,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1212,7 +1212,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1226,7 +1226,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1240,7 +1240,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1254,7 +1254,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2104,7 +2104,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2178,7 +2178,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14--0.13.3.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.14--0.13.3.1.sql index 5d3d87d..5738f40 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14--0.13.3.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14--0.13.3.1.sql @@ -634,7 +634,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( username TEXT, @@ -707,7 +707,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ #plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Routing @@ -767,7 +767,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- DO augmentation diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14--0.14.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.14--0.14.1.sql index 3b2dc05..4e1cd55 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14--0.14.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14--0.14.1.sql @@ -62,4 +62,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14.1--0.14.sql b/server/extension/old_versions/cdb_dataservices_server--0.14.1--0.14.sql index 6a99f79..1c91dc5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14.1--0.14.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14.1--0.14.sql @@ -62,4 +62,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.14.1.sql index c4470ef..5ebdfb5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14.1.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -122,7 +122,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1223,7 +1223,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1237,7 +1237,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1251,7 +1251,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1265,7 +1265,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1279,7 +1279,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1293,7 +1293,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1307,7 +1307,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2188,7 +2188,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2262,7 +2262,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14.2--0.15.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.14.2--0.15.0.sql index 4061d63..d432851 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14.2--0.15.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14.2--0.15.0.sql @@ -17,7 +17,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; ---- cdb_geocode_namedplace_point(city_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.14.2.sql index 2972cd9..8c37f2e 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14.2.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -122,7 +122,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1223,7 +1223,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1237,7 +1237,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1251,7 +1251,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1265,7 +1265,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1279,7 +1279,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1293,7 +1293,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1307,7 +1307,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2188,7 +2188,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2262,7 +2262,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.14.sql b/server/extension/old_versions/cdb_dataservices_server--0.14.sql index 9d03454..d0d9d97 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.14.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.14.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -122,7 +122,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1223,7 +1223,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1237,7 +1237,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1251,7 +1251,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1265,7 +1265,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1279,7 +1279,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1293,7 +1293,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1307,7 +1307,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2188,7 +2188,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2262,7 +2262,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.15.0--0.14.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.15.0--0.14.2.sql index ced6499..dd2edef 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.15.0--0.14.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.15.0--0.14.2.sql @@ -19,7 +19,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) RETURNS Geometry AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.15.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.15.1.sql index 5006a1e..c416e90 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.15.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.15.1.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -122,7 +122,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1223,7 +1223,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text, provider text DEFAULT NULL) RETURNS boolean AS $$ @@ -1237,7 +1237,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1251,7 +1251,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1265,7 +1265,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1279,7 +1279,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1293,7 +1293,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1307,7 +1307,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2200,7 +2200,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2274,7 +2274,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.16.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.16.0.sql index 3bc37ad..4507a41 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.16.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.16.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -122,7 +122,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1223,7 +1223,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1243,7 +1243,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1257,7 +1257,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1271,7 +1271,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1285,7 +1285,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1299,7 +1299,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1313,7 +1313,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2222,7 +2222,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2296,7 +2296,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.17.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.17.0.sql index 7c060bc..2afe550 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.17.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.17.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -132,7 +132,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1271,7 +1271,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1291,7 +1291,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1305,7 +1305,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1319,7 +1319,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1333,7 +1333,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1347,7 +1347,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1361,7 +1361,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2296,7 +2296,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2370,7 +2370,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.18.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.18.0.sql index 2cfea6a..047fa57 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.18.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.18.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1343,7 +1343,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1363,7 +1363,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1377,7 +1377,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1391,7 +1391,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1405,7 +1405,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1419,7 +1419,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1433,7 +1433,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2368,7 +2368,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2442,7 +2442,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.18.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.18.1.sql index 5fb2e20..a1de4cb 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.18.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.18.1.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1343,7 +1343,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1363,7 +1363,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1377,7 +1377,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1391,7 +1391,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1405,7 +1405,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1419,7 +1419,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1433,7 +1433,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2368,7 +2368,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2442,7 +2442,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.19.0--0.20.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.19.0--0.20.0.sql index 9290e24..b5cf55c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.19.0--0.20.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.19.0--0.20.0.sql @@ -68,7 +68,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -132,7 +132,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.19.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.19.0.sql index b3bb470..50c38f5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.19.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.19.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1343,7 +1343,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1363,7 +1363,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1377,7 +1377,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1391,7 +1391,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1405,7 +1405,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1419,7 +1419,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1433,7 +1433,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2473,7 +2473,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isolines( @@ -2547,7 +2547,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.2.0--0.1.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.2.0--0.1.0.sql index d2a3ad3..045e0b0 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.2.0--0.1.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.2.0--0.1.0.sql @@ -22,7 +22,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) @@ -53,7 +53,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.2.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.2.0.sql index 9c66887..bf05af2 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.2.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.2.0.sql @@ -57,7 +57,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -82,7 +82,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.20.0--0.19.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.20.0--0.19.0.sql index eba02e6..0e2c8dd 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.20.0--0.19.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.20.0--0.19.0.sql @@ -70,7 +70,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.20.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.20.0.sql index 0bf4bcc..f101bbb 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.20.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.20.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1343,7 +1343,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1363,7 +1363,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1377,7 +1377,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1391,7 +1391,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1405,7 +1405,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1419,7 +1419,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1433,7 +1433,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2473,7 +2473,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2539,7 +2539,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2603,7 +2603,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.21.0--0.22.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.21.0--0.22.0.sql index b441abb..d97ce2c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.21.0--0.22.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.21.0--0.22.0.sql @@ -62,7 +62,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -225,7 +225,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -289,4 +289,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.21.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.21.0.sql index 3e714d1..4657310 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.21.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.21.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1533,7 +1533,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1547,7 +1547,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1561,7 +1561,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1575,7 +1575,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1589,7 +1589,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1603,7 +1603,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2643,7 +2643,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2709,7 +2709,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2773,7 +2773,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.22.0--0.21.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.22.0--0.21.0.sql index 849690a..433e692 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.22.0--0.21.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.22.0--0.21.0.sql @@ -62,7 +62,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -225,7 +225,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -289,4 +289,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.22.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.22.0.sql index 77255d0..53ac78e 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.22.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.22.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1533,7 +1533,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1547,7 +1547,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1561,7 +1561,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1575,7 +1575,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1589,7 +1589,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1603,7 +1603,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2643,7 +2643,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2709,7 +2709,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2773,7 +2773,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.23.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.23.0.sql index 713ad58..7deb1c6 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.23.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.23.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1551,7 +1551,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1565,7 +1565,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1579,7 +1579,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1593,7 +1593,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1607,7 +1607,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1621,7 +1621,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2720,7 +2720,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2786,7 +2786,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2850,7 +2850,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.24.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.24.0.sql index 182922f..57484c9 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.24.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.24.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1551,7 +1551,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1565,7 +1565,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1579,7 +1579,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1593,7 +1593,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1607,7 +1607,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1621,7 +1621,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2720,7 +2720,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2786,7 +2786,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2850,7 +2850,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.24.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.24.1.sql index a529f4e..5c11d24 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.24.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.24.1.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1551,7 +1551,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1565,7 +1565,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1579,7 +1579,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1593,7 +1593,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1607,7 +1607,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1621,7 +1621,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2720,7 +2720,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2786,7 +2786,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2850,7 +2850,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.24.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.24.2.sql index b8257f7..2f2420f 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.24.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.24.2.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1551,7 +1551,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1565,7 +1565,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1579,7 +1579,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1593,7 +1593,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1607,7 +1607,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1621,7 +1621,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2723,7 +2723,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2789,7 +2789,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2853,7 +2853,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.25.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.25.0.sql index c6c7ed0..9cc17d7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.25.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.25.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1513,7 +1513,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1551,7 +1551,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1565,7 +1565,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1579,7 +1579,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1593,7 +1593,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1607,7 +1607,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1621,7 +1621,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2747,7 +2747,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2813,7 +2813,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2877,7 +2877,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.26.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.26.0.sql index 4a878ad..12bc9d7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.26.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.26.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1530,7 +1530,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1568,7 +1568,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1582,7 +1582,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1596,7 +1596,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1610,7 +1610,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1624,7 +1624,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1638,7 +1638,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2764,7 +2764,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2830,7 +2830,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2894,7 +2894,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.27.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.27.0.sql index bc715df..3962f70 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.27.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.27.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1576,7 +1576,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1614,7 +1614,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1628,7 +1628,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1642,7 +1642,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1656,7 +1656,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1670,7 +1670,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1684,7 +1684,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2810,7 +2810,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2876,7 +2876,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2940,7 +2940,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.28.0--0.29.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.28.0--0.29.0.sql index e32af4d..d872a35 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.28.0--0.29.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.28.0--0.29.0.sql @@ -61,7 +61,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -86,7 +86,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_route_with_waypoints($1, $2, $3, $4, $5, $6) as route;", ["text", "text", "geometry(Point, 4326)[]", "text", "text[]", "text"]) result = plpy.execute(mapzen_plan, [username, orgname, waypoints, mode, options, units]) return [result[0]['shape'],result[0]['length'], result[0]['duration']] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -111,7 +111,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_route_with_waypoints($1, $2, $3, $4, $5, $6) as route;", ["text", "text", "geometry(Point, 4326)[]", "text", "text[]", "text"]) result = plpy.execute(mapzen_plan, [username, orgname, waypoints, mode, options, units]) return [result[0]['shape'],result[0]['length'], result[0]['duration']] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -129,7 +129,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -146,7 +146,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -200,7 +200,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -257,7 +257,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -309,7 +309,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -364,7 +364,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -421,7 +421,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -476,7 +476,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -533,7 +533,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -588,7 +588,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -643,7 +643,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -698,7 +698,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -759,7 +759,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -820,7 +820,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -868,7 +868,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -914,7 +914,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -972,7 +972,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1030,7 +1030,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1082,7 +1082,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1135,7 +1135,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1188,7 +1188,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1248,7 +1248,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1310,7 +1310,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1370,7 +1370,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1432,7 +1432,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1440,7 +1440,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1563,7 +1563,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1601,7 +1601,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1615,7 +1615,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1629,7 +1629,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1643,7 +1643,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1657,7 +1657,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1671,7 +1671,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info( username TEXT, @@ -1735,7 +1735,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1779,7 +1779,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1795,7 +1795,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1810,7 +1810,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1823,7 +1823,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1852,7 +1852,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1881,7 +1881,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -1938,7 +1938,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -1962,7 +1962,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -1986,7 +1986,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2010,7 +2010,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2045,7 +2045,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2102,7 +2102,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2140,7 +2140,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2205,7 +2205,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2217,7 +2217,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2229,7 +2229,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2274,7 +2274,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode city point using mapzen') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2317,7 +2317,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2421,7 +2421,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2463,7 +2463,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2505,7 +2505,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2548,7 +2548,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2684,7 +2684,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2772,7 +2772,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2838,7 +2838,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2902,7 +2902,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -2928,7 +2928,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -2943,7 +2943,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -2957,7 +2957,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -2983,7 +2983,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -2998,7 +2998,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3011,4 +3011,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.28.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.28.0.sql index 588ad8e..d5ee6cc 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.28.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.28.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1577,7 +1577,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1615,7 +1615,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1629,7 +1629,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1643,7 +1643,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1657,7 +1657,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1671,7 +1671,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1685,7 +1685,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -2811,7 +2811,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2877,7 +2877,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2941,7 +2941,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.28.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.28.0.sql index 18e7b9c..f6f9096 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.28.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.28.0.sql @@ -64,7 +64,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -132,7 +132,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1567,7 +1567,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1605,7 +1605,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1619,7 +1619,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1633,7 +1633,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1647,7 +1647,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1661,7 +1661,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1675,7 +1675,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info( @@ -2777,7 +2777,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2843,7 +2843,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2907,7 +2907,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics diff --git a/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.30.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.30.0.sql index 0fc7486..b8f88a7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.30.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.29.0--0.30.0.sql @@ -62,7 +62,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, @@ -97,7 +97,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( username TEXT, @@ -129,7 +129,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -159,7 +159,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -172,7 +172,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -210,7 +210,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -250,7 +250,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) @@ -270,7 +270,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -290,7 +290,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -310,7 +310,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -375,7 +375,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -436,7 +436,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ @@ -466,7 +466,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -480,7 +480,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ @@ -510,7 +510,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -523,7 +523,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData( username TEXT, @@ -570,7 +570,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData( username TEXT, @@ -618,7 +618,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetMeta( username TEXT, @@ -653,4 +653,4 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.29.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.29.0.sql index 045f23b..7ecb9d3 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.29.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.29.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -91,7 +91,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_route_with_waypoints($1, $2, $3, $4, $5, $6) as route;", ["text", "text", "geometry(Point, 4326)[]", "text", "text[]", "text"]) result = plpy.execute(mapzen_plan, [username, orgname, waypoints, mode, options, units]) return [result[0]['shape'],result[0]['length'], result[0]['duration']] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -116,7 +116,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_route_with_waypoints($1, $2, $3, $4, $5, $6) as route;", ["text", "text", "geometry(Point, 4326)[]", "text", "text[]", "text"]) result = plpy.execute(mapzen_plan, [username, orgname, waypoints, mode, options, units]) return [result[0]['shape'],result[0]['length'], result[0]['duration']] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -134,7 +134,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -151,7 +151,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -205,7 +205,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -262,7 +262,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -314,7 +314,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -369,7 +369,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -426,7 +426,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -481,7 +481,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -538,7 +538,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -593,7 +593,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -648,7 +648,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -703,7 +703,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -764,7 +764,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -825,7 +825,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -873,7 +873,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -919,7 +919,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -977,7 +977,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1035,7 +1035,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1087,7 +1087,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1140,7 +1140,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1193,7 +1193,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1253,7 +1253,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1315,7 +1315,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1375,7 +1375,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1437,7 +1437,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1448,7 +1448,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1577,7 +1577,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1615,7 +1615,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1629,7 +1629,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1643,7 +1643,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1657,7 +1657,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1671,7 +1671,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1685,7 +1685,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'service_type') THEN @@ -1773,7 +1773,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1817,7 +1817,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1833,7 +1833,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1848,7 +1848,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1861,7 +1861,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1890,7 +1890,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1957,7 +1957,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -1976,7 +1976,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2000,7 +2000,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2024,7 +2024,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2048,7 +2048,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2083,7 +2083,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2140,7 +2140,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2178,7 +2178,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2243,7 +2243,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2255,7 +2255,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2267,7 +2267,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2312,7 +2312,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode city point using mapzen') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2355,7 +2355,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2459,7 +2459,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2501,7 +2501,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2543,7 +2543,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2586,7 +2586,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2722,7 +2722,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2811,7 +2811,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2877,7 +2877,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( @@ -2941,7 +2941,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -2967,7 +2967,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -2982,7 +2982,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -2996,7 +2996,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3022,7 +3022,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3037,7 +3037,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3050,7 +3050,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.3.0--0.4.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.3.0--0.4.0.sql index d56be82..facff74 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.3.0--0.4.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.3.0--0.4.0.sql @@ -22,7 +22,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE TYPE cdb_dataservices_server.isoline AS (center geometry(Geometry,4326), data_range integer, the_geom geometry(Multipolygon,4326)); @@ -77,7 +77,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.3.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.3.0.sql index c34e8a4..ce02822 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.3.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.3.0.sql @@ -57,7 +57,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -82,7 +82,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.29.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.29.0.sql index acabd05..944d270 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.29.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.29.0.sql @@ -29,7 +29,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_route_with_waypoints($1, $2, $3, $4, $5, $6) as route;", ["text", "text", "geometry(Point, 4326)[]", "text", "text[]", "text"]) result = plpy.execute(mapzen_plan, [username, orgname, waypoints, mode, options, units]) return [result[0]['shape'],result[0]['length'], result[0]['duration']] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( username TEXT, @@ -53,7 +53,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_route_with_waypoints($1, $2, $3, $4, $5, $6) as route;", ["text", "text", "geometry(Point, 4326)[]", "text", "text[]", "text"]) result = plpy.execute(mapzen_plan, [username, orgname, waypoints, mode, options, units]) return [result[0]['shape'],result[0]['length'], result[0]['duration']] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -80,7 +80,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT, state_province TEXT, country TEXT); @@ -120,7 +120,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT, state_province TEXT, country TEXT); @@ -134,7 +134,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -146,7 +146,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -158,7 +158,7 @@ RETURNS Geometry AS $$ except spiexceptions.ExternalRoutineException as e: internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server._cdb_mapbox_geocode_namedplace(username text, orgname text, city_name text, admin1_name text, country_name text); @@ -205,7 +205,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode city point using mapzen') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server._cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, data_range integer[], options text[]); @@ -236,7 +236,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[]); @@ -265,7 +265,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ 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[]); @@ -314,7 +314,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetData( username TEXT, @@ -362,7 +362,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetMeta( username TEXT, @@ -397,4 +397,4 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.30.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.30.1.sql index 072c847..f10bedf 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.30.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.0--0.30.1.sql @@ -44,4 +44,4 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.0.sql index 02ceec5..88703f8 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -161,7 +161,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -194,7 +194,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -212,7 +212,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -229,7 +229,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -283,7 +283,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -340,7 +340,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -392,7 +392,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -447,7 +447,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -504,7 +504,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -559,7 +559,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -616,7 +616,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -671,7 +671,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -726,7 +726,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -781,7 +781,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -842,7 +842,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -903,7 +903,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -951,7 +951,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -997,7 +997,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1055,7 +1055,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1113,7 +1113,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1165,7 +1165,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1218,7 +1218,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1271,7 +1271,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1331,7 +1331,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1393,7 +1393,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1453,7 +1453,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1515,7 +1515,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1526,7 +1526,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1655,7 +1655,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1693,7 +1693,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1707,7 +1707,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1721,7 +1721,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1735,7 +1735,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1749,7 +1749,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1763,7 +1763,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1855,7 +1855,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1903,7 +1903,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1934,7 +1934,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1947,7 +1947,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1960,7 +1960,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1989,7 +1989,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2018,7 +2018,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2056,7 +2056,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2096,7 +2096,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2115,7 +2115,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2139,7 +2139,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2163,7 +2163,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2187,7 +2187,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2222,7 +2222,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2279,7 +2279,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2317,7 +2317,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2390,7 +2390,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2410,7 +2410,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2430,7 +2430,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2473,7 +2473,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2577,7 +2577,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2619,7 +2619,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2661,7 +2661,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2704,7 +2704,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2840,7 +2840,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2929,7 +2929,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2995,7 +2995,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3060,7 +3060,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3123,7 +3123,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3184,7 +3184,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3213,7 +3213,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3228,7 +3228,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3242,7 +3242,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3256,7 +3256,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3285,7 +3285,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3300,7 +3300,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3313,7 +3313,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3326,7 +3326,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.0.sql index 434c7f0..11f6142 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.0.sql @@ -41,4 +41,4 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.2.sql index 07be2bd..2c3eda3 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.1--0.30.2.sql @@ -34,7 +34,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -66,7 +66,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -107,7 +107,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -153,4 +153,4 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.1.sql index ae00156..bb57745 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.1.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -161,7 +161,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -194,7 +194,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -212,7 +212,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -229,7 +229,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -283,7 +283,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -340,7 +340,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -392,7 +392,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -447,7 +447,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -504,7 +504,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -559,7 +559,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -616,7 +616,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -671,7 +671,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -726,7 +726,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -781,7 +781,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -842,7 +842,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -903,7 +903,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -951,7 +951,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -997,7 +997,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1055,7 +1055,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1113,7 +1113,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1165,7 +1165,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1218,7 +1218,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1271,7 +1271,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1331,7 +1331,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1393,7 +1393,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1453,7 +1453,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1515,7 +1515,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1526,7 +1526,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1655,7 +1655,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1693,7 +1693,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1707,7 +1707,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1721,7 +1721,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1735,7 +1735,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1749,7 +1749,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1763,7 +1763,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1855,7 +1855,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1903,7 +1903,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1934,7 +1934,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1947,7 +1947,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1960,7 +1960,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1989,7 +1989,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2018,7 +2018,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2056,7 +2056,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2099,7 +2099,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2118,7 +2118,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2142,7 +2142,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2166,7 +2166,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2190,7 +2190,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2225,7 +2225,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2282,7 +2282,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2320,7 +2320,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2393,7 +2393,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2413,7 +2413,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2433,7 +2433,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2476,7 +2476,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2580,7 +2580,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2622,7 +2622,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2664,7 +2664,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2707,7 +2707,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2843,7 +2843,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2932,7 +2932,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -2998,7 +2998,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3063,7 +3063,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3126,7 +3126,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3187,7 +3187,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3216,7 +3216,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3231,7 +3231,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3245,7 +3245,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3259,7 +3259,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3288,7 +3288,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3303,7 +3303,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3316,7 +3316,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3329,7 +3329,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.1.sql index 53bede2..b1c18f5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.1.sql @@ -30,7 +30,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -68,7 +68,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -111,4 +111,4 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.3.sql index a07a840..cde5eb6 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.2--0.30.3.sql @@ -67,4 +67,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.2.sql index 7e9a231..09701f4 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.2.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -161,7 +161,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -194,7 +194,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -212,7 +212,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -229,7 +229,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -283,7 +283,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -340,7 +340,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -392,7 +392,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -447,7 +447,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -504,7 +504,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -559,7 +559,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -616,7 +616,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -671,7 +671,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -726,7 +726,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -781,7 +781,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -842,7 +842,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -903,7 +903,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -951,7 +951,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -997,7 +997,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1055,7 +1055,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1113,7 +1113,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1165,7 +1165,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1218,7 +1218,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1271,7 +1271,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1331,7 +1331,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1393,7 +1393,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1453,7 +1453,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1515,7 +1515,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1526,7 +1526,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1655,7 +1655,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1693,7 +1693,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1707,7 +1707,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1721,7 +1721,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1735,7 +1735,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1749,7 +1749,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1763,7 +1763,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1855,7 +1855,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1903,7 +1903,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1934,7 +1934,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1947,7 +1947,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1960,7 +1960,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1993,7 +1993,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2022,7 +2022,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2063,7 +2063,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2109,7 +2109,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2128,7 +2128,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2152,7 +2152,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2176,7 +2176,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2200,7 +2200,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2235,7 +2235,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2292,7 +2292,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2330,7 +2330,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2403,7 +2403,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2423,7 +2423,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2443,7 +2443,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2486,7 +2486,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2590,7 +2590,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2632,7 +2632,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2674,7 +2674,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2717,7 +2717,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2853,7 +2853,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2942,7 +2942,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3008,7 +3008,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3073,7 +3073,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3136,7 +3136,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3197,7 +3197,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3226,7 +3226,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3241,7 +3241,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3255,7 +3255,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3269,7 +3269,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3298,7 +3298,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3313,7 +3313,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3326,7 +3326,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3339,7 +3339,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.2.sql index d950acb..79f008f 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.2.sql @@ -67,4 +67,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.4.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.4.sql index 5db9881..d1054e1 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.4.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.3--0.30.4.sql @@ -66,4 +66,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.3.sql index 62baa15..5a792fd 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.3.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -161,7 +161,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -194,7 +194,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -212,7 +212,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -229,7 +229,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -283,7 +283,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -340,7 +340,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -392,7 +392,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -447,7 +447,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -504,7 +504,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -559,7 +559,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -616,7 +616,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -671,7 +671,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -726,7 +726,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -781,7 +781,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -842,7 +842,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -903,7 +903,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -951,7 +951,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -997,7 +997,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1055,7 +1055,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1113,7 +1113,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1165,7 +1165,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1218,7 +1218,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1271,7 +1271,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1331,7 +1331,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1393,7 +1393,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1453,7 +1453,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1515,7 +1515,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1526,7 +1526,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1655,7 +1655,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1693,7 +1693,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1707,7 +1707,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1721,7 +1721,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1735,7 +1735,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1749,7 +1749,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1763,7 +1763,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1855,7 +1855,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1903,7 +1903,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1934,7 +1934,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1947,7 +1947,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1960,7 +1960,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1993,7 +1993,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2025,7 +2025,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2066,7 +2066,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2112,7 +2112,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2131,7 +2131,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2155,7 +2155,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2179,7 +2179,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2203,7 +2203,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2238,7 +2238,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2295,7 +2295,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2333,7 +2333,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2406,7 +2406,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2426,7 +2426,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2446,7 +2446,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2489,7 +2489,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2593,7 +2593,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2635,7 +2635,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2677,7 +2677,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2720,7 +2720,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2856,7 +2856,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2945,7 +2945,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3011,7 +3011,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3076,7 +3076,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3139,7 +3139,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3200,7 +3200,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3229,7 +3229,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3244,7 +3244,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3258,7 +3258,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3272,7 +3272,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3301,7 +3301,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3316,7 +3316,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3329,7 +3329,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3342,7 +3342,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.3.sql index b875bdb..c197e24 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.3.sql @@ -66,4 +66,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.5.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.5.sql index 7f5648a..0fd3387 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.5.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.4--0.30.5.sql @@ -65,4 +65,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.4.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.4.sql index db7b1ba..e05a69f 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.4.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.4.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -161,7 +161,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -194,7 +194,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -212,7 +212,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -229,7 +229,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -283,7 +283,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -340,7 +340,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -392,7 +392,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -447,7 +447,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -504,7 +504,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -559,7 +559,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -616,7 +616,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -671,7 +671,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -726,7 +726,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -781,7 +781,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -842,7 +842,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -903,7 +903,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -951,7 +951,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -997,7 +997,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1055,7 +1055,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1113,7 +1113,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1165,7 +1165,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1218,7 +1218,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1271,7 +1271,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1331,7 +1331,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1393,7 +1393,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1453,7 +1453,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1515,7 +1515,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1526,7 +1526,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1655,7 +1655,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1693,7 +1693,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1707,7 +1707,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1721,7 +1721,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1735,7 +1735,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1749,7 +1749,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1763,7 +1763,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1855,7 +1855,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1903,7 +1903,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1934,7 +1934,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1947,7 +1947,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1960,7 +1960,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1993,7 +1993,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2025,7 +2025,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2066,7 +2066,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2112,7 +2112,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2131,7 +2131,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2155,7 +2155,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2179,7 +2179,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2203,7 +2203,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2238,7 +2238,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2295,7 +2295,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2333,7 +2333,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2406,7 +2406,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2426,7 +2426,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2446,7 +2446,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2489,7 +2489,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2593,7 +2593,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2635,7 +2635,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2677,7 +2677,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2720,7 +2720,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2856,7 +2856,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2945,7 +2945,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3011,7 +3011,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3076,7 +3076,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3139,7 +3139,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3200,7 +3200,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3229,7 +3229,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3244,7 +3244,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3258,7 +3258,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3272,7 +3272,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3301,7 +3301,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3316,7 +3316,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3329,7 +3329,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3342,7 +3342,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.30.4.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.30.4.sql index eaff320..11ed9b6 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.30.4.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.30.4.sql @@ -65,4 +65,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.31.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.31.0.sql index cf67925..f7bb9ba 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.31.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.5--0.31.0.sql @@ -62,7 +62,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( @@ -104,7 +104,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -143,7 +143,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -179,7 +179,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -193,7 +193,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -240,7 +240,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( @@ -305,7 +305,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( @@ -366,7 +366,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -402,7 +402,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance @@ -417,7 +417,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -453,7 +453,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone @@ -467,4 +467,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.30.5.sql b/server/extension/old_versions/cdb_dataservices_server--0.30.5.sql index f8c24a5..49b52b1 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.30.5.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.30.5.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -161,7 +161,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -194,7 +194,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -212,7 +212,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; -- -- Observatory connection config -- @@ -229,7 +229,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -283,7 +283,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -340,7 +340,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -392,7 +392,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -447,7 +447,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -504,7 +504,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -559,7 +559,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -616,7 +616,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -671,7 +671,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -726,7 +726,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -781,7 +781,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -842,7 +842,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -903,7 +903,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -951,7 +951,7 @@ RETURNS JSON AS $$ 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 ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -997,7 +997,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1055,7 +1055,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1113,7 +1113,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1165,7 +1165,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1218,7 +1218,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1271,7 +1271,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1331,7 +1331,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1393,7 +1393,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1453,7 +1453,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1515,7 +1515,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1526,7 +1526,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1655,7 +1655,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1693,7 +1693,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1707,7 +1707,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1721,7 +1721,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1735,7 +1735,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1749,7 +1749,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1763,7 +1763,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1855,7 +1855,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1903,7 +1903,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1919,7 +1919,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1934,7 +1934,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1947,7 +1947,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1960,7 +1960,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1993,7 +1993,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2025,7 +2025,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2066,7 +2066,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2112,7 +2112,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2131,7 +2131,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2155,7 +2155,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE ; +$$ LANGUAGE @@plpythonu@@ VOLATILE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2179,7 +2179,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2203,7 +2203,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE ; +$$ LANGUAGE @@plpythonu@@ VOLATILE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2238,7 +2238,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -------------------------------------------------------------------------------- @@ -2295,7 +2295,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2333,7 +2333,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -------------------------------------------------------------------------------- @@ -2406,7 +2406,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2426,7 +2426,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2446,7 +2446,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2489,7 +2489,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -------------------------------------------------------------------------------- @@ -2593,7 +2593,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2635,7 +2635,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2677,7 +2677,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2720,7 +2720,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2856,7 +2856,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -------------------------------------------------------------------------------- @@ -2945,7 +2945,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3011,7 +3011,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3076,7 +3076,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3139,7 +3139,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3200,7 +3200,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE ; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3229,7 +3229,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3244,7 +3244,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3258,7 +3258,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3272,7 +3272,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3301,7 +3301,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3316,7 +3316,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3329,7 +3329,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3342,7 +3342,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.30.5.sql b/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.30.5.sql index afbd6ad..157b982 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.30.5.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.30.5.sql @@ -38,7 +38,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -71,7 +71,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -102,7 +102,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_tomtom_geocode_street_point(TEXT, TEXT, TEXT, TEXT, TEXT, TEXT); @@ -142,7 +142,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_tomtom_isodistance(TEXT, TEXT, geometry(Geometry, 4326), TEXT, integer[], text[]); @@ -176,7 +176,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE ; +$$ LANGUAGE @@plpythonu@@ STABLE ; DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_tomtom_isochrone(TEXT, TEXT, geometry(Geometry, 4326), TEXT, integer[], text[]); diff --git a/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.32.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.32.0.sql index 45faaac..c5375f8 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.32.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.31.0--0.32.0.sql @@ -48,7 +48,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( @@ -89,7 +89,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -100,7 +100,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -111,7 +111,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -128,7 +128,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -145,4 +145,4 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.31.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.31.0.sql index 2e7b27c..d3750f0 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.31.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.31.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -188,7 +188,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -228,7 +228,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -267,7 +267,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -285,7 +285,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -302,7 +302,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -356,7 +356,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -413,7 +413,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -465,7 +465,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -520,7 +520,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -577,7 +577,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -632,7 +632,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -689,7 +689,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -744,7 +744,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -799,7 +799,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -854,7 +854,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -915,7 +915,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -976,7 +976,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1024,7 +1024,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1070,7 +1070,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1128,7 +1128,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1186,7 +1186,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1238,7 +1238,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1291,7 +1291,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1344,7 +1344,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1404,7 +1404,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1466,7 +1466,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1526,7 +1526,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1588,7 +1588,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1599,7 +1599,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1728,7 +1728,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1766,7 +1766,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1780,7 +1780,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1794,7 +1794,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1808,7 +1808,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1822,7 +1822,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1836,7 +1836,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1928,7 +1928,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( @@ -1981,7 +1981,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -1997,7 +1997,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2012,7 +2012,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2025,7 +2025,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2038,7 +2038,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2051,7 +2051,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2084,7 +2084,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2116,7 +2116,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2157,7 +2157,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2203,7 +2203,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2249,7 +2249,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2268,7 +2268,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2292,7 +2292,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2316,7 +2316,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2340,7 +2340,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2375,7 +2375,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2432,7 +2432,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2470,7 +2470,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2543,7 +2543,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2563,7 +2563,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2583,7 +2583,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2626,7 +2626,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2730,7 +2730,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2772,7 +2772,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2814,7 +2814,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2857,7 +2857,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2993,7 +2993,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3082,7 +3082,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3148,7 +3148,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3213,7 +3213,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3277,7 +3277,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3340,7 +3340,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3401,7 +3401,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3461,7 +3461,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3495,7 +3495,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3510,7 +3510,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3524,7 +3524,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3538,7 +3538,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3552,7 +3552,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3586,7 +3586,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3601,7 +3601,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3614,7 +3614,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3627,7 +3627,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3640,7 +3640,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.32.0--0.33.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.32.0--0.33.0.sql index 610916d..c29172e 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.32.0--0.33.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.32.0--0.33.0.sql @@ -15,7 +15,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, @@ -58,7 +58,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetDemographicSnapshot( username TEXT, @@ -104,7 +104,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_segment_snapshot( username TEXT, @@ -146,7 +146,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -201,4 +201,4 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.32.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.32.0.sql index 42d9b9e..bb2a283 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.32.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.32.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -188,7 +188,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -228,7 +228,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -267,7 +267,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -285,7 +285,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -302,7 +302,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -356,7 +356,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -413,7 +413,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -465,7 +465,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -520,7 +520,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -577,7 +577,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -632,7 +632,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -689,7 +689,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -744,7 +744,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -799,7 +799,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -854,7 +854,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -915,7 +915,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -976,7 +976,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1024,7 +1024,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1070,7 +1070,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1128,7 +1128,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1186,7 +1186,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1238,7 +1238,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1291,7 +1291,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1344,7 +1344,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1404,7 +1404,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1466,7 +1466,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1526,7 +1526,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1588,7 +1588,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1599,7 +1599,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1728,7 +1728,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1766,7 +1766,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1780,7 +1780,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1794,7 +1794,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1808,7 +1808,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1822,7 +1822,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1836,7 +1836,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1945,7 +1945,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1975,7 +1975,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2027,7 +2027,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2043,7 +2043,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2058,7 +2058,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2071,7 +2071,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2084,7 +2084,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2097,7 +2097,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2130,7 +2130,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2162,7 +2162,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2203,7 +2203,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2249,7 +2249,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2295,7 +2295,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2314,7 +2314,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2338,7 +2338,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2362,7 +2362,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2386,7 +2386,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2426,7 +2426,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2437,7 +2437,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2448,7 +2448,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2465,7 +2465,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2482,7 +2482,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2518,7 +2518,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2575,7 +2575,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2613,7 +2613,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2686,7 +2686,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2706,7 +2706,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2726,7 +2726,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2769,7 +2769,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2873,7 +2873,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2915,7 +2915,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2957,7 +2957,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3000,7 +3000,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3136,7 +3136,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3225,7 +3225,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3291,7 +3291,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3356,7 +3356,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3420,7 +3420,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3483,7 +3483,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3544,7 +3544,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3604,7 +3604,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3638,7 +3638,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3653,7 +3653,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3667,7 +3667,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3681,7 +3681,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3695,7 +3695,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3729,7 +3729,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3744,7 +3744,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3757,7 +3757,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3770,7 +3770,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3783,7 +3783,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.32.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.32.0.sql index 1a30b9d..0f4ad81 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.32.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.32.0.sql @@ -15,7 +15,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._obs_server_conn_str( username TEXT, @@ -27,7 +27,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, @@ -70,7 +70,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetDemographicSnapshot( username TEXT, @@ -116,7 +116,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_segment_snapshot( username TEXT, @@ -158,7 +158,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -213,4 +213,4 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.34.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.34.0.sql index 8c3ede9..5fb72c9 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.34.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.33.0--0.34.0.sql @@ -43,7 +43,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -82,7 +82,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -117,7 +117,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -151,7 +151,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -190,7 +190,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) RETURNS Geometry AS $$ @@ -229,7 +229,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -274,7 +274,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code text) RETURNS Geometry AS $$ @@ -313,7 +313,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_ipaddress_point(username text, orgname text, ip text) RETURNS Geometry AS $$ @@ -352,7 +352,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ @@ -387,7 +387,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ @@ -422,4 +422,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.33.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.33.0.sql index 42d9b9e..bb2a283 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.33.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.33.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -188,7 +188,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -228,7 +228,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -267,7 +267,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -285,7 +285,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -302,7 +302,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -356,7 +356,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -413,7 +413,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -465,7 +465,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -520,7 +520,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -577,7 +577,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -632,7 +632,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -689,7 +689,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -744,7 +744,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -799,7 +799,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -854,7 +854,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -915,7 +915,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -976,7 +976,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1024,7 +1024,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1070,7 +1070,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1128,7 +1128,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1186,7 +1186,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1238,7 +1238,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1291,7 +1291,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1344,7 +1344,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1404,7 +1404,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1466,7 +1466,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1526,7 +1526,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1588,7 +1588,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1599,7 +1599,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1728,7 +1728,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1766,7 +1766,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1780,7 +1780,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1794,7 +1794,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1808,7 +1808,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1822,7 +1822,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1836,7 +1836,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1945,7 +1945,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1975,7 +1975,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2027,7 +2027,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2043,7 +2043,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2058,7 +2058,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2071,7 +2071,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2084,7 +2084,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2097,7 +2097,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2130,7 +2130,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2162,7 +2162,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2203,7 +2203,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2249,7 +2249,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2295,7 +2295,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2314,7 +2314,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2338,7 +2338,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2362,7 +2362,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2386,7 +2386,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2426,7 +2426,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2437,7 +2437,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2448,7 +2448,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2465,7 +2465,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2482,7 +2482,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2518,7 +2518,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2575,7 +2575,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2613,7 +2613,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2686,7 +2686,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2706,7 +2706,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2726,7 +2726,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2769,7 +2769,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2873,7 +2873,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2915,7 +2915,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2957,7 +2957,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3000,7 +3000,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3136,7 +3136,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3225,7 +3225,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3291,7 +3291,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3356,7 +3356,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3420,7 +3420,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3483,7 +3483,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3544,7 +3544,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3604,7 +3604,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3638,7 +3638,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3653,7 +3653,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3667,7 +3667,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3681,7 +3681,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3695,7 +3695,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3729,7 +3729,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3744,7 +3744,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3757,7 +3757,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3770,7 +3770,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3783,7 +3783,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.33.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.33.0.sql index e74ed22..b46fead 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.33.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.33.0.sql @@ -43,7 +43,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -82,7 +82,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -117,7 +117,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -151,7 +151,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -187,7 +187,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) RETURNS Geometry AS $$ @@ -224,7 +224,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -267,7 +267,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code text) RETURNS Geometry AS $$ @@ -303,7 +303,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_ipaddress_point(username text, orgname text, ip text) RETURNS Geometry AS $$ @@ -339,7 +339,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ @@ -374,7 +374,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ @@ -409,4 +409,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.34.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.34.1.sql index 430d384..37b2228 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.34.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.0--0.34.1.sql @@ -62,7 +62,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -121,7 +121,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -179,4 +179,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.0.sql index 80b1900..50df4f4 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.0.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -188,7 +188,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -228,7 +228,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -267,7 +267,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -285,7 +285,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -302,7 +302,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -356,7 +356,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -413,7 +413,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -465,7 +465,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -520,7 +520,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -577,7 +577,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -632,7 +632,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -689,7 +689,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -744,7 +744,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -799,7 +799,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -854,7 +854,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -915,7 +915,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -976,7 +976,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1024,7 +1024,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1070,7 +1070,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1128,7 +1128,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1186,7 +1186,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1238,7 +1238,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1291,7 +1291,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1344,7 +1344,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1404,7 +1404,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1466,7 +1466,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1526,7 +1526,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1588,7 +1588,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1599,7 +1599,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1728,7 +1728,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1766,7 +1766,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1780,7 +1780,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1794,7 +1794,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1808,7 +1808,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1822,7 +1822,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1931,7 +1931,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1961,7 +1961,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2013,7 +2013,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2029,7 +2029,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2044,7 +2044,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2057,7 +2057,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2070,7 +2070,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2083,7 +2083,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2116,7 +2116,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2148,7 +2148,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2189,7 +2189,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2235,7 +2235,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2281,7 +2281,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2300,7 +2300,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2324,7 +2324,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2348,7 +2348,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2372,7 +2372,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2412,7 +2412,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2423,7 +2423,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2434,7 +2434,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2451,7 +2451,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2468,7 +2468,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2507,7 +2507,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2566,7 +2566,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2604,7 +2604,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2677,7 +2677,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2697,7 +2697,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2717,7 +2717,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2762,7 +2762,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2869,7 +2869,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2911,7 +2911,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2953,7 +2953,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2996,7 +2996,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3135,7 +3135,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3224,7 +3224,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3290,7 +3290,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3355,7 +3355,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3419,7 +3419,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3482,7 +3482,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3543,7 +3543,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3603,7 +3603,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3637,7 +3637,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3652,7 +3652,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3666,7 +3666,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3680,7 +3680,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3694,7 +3694,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3728,7 +3728,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3743,7 +3743,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3756,7 +3756,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3769,7 +3769,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3782,7 +3782,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.0.sql index 248b962..4e19c56 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.0.sql @@ -64,7 +64,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -125,7 +125,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -185,4 +185,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.2.sql index 5fd13f5..e94edee 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.1--0.34.2.sql @@ -36,4 +36,4 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.1.sql index 8197024..73a598f 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.1.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -188,7 +188,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -228,7 +228,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -267,7 +267,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -285,7 +285,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -302,7 +302,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -356,7 +356,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -413,7 +413,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -465,7 +465,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -520,7 +520,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -577,7 +577,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -632,7 +632,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -689,7 +689,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -744,7 +744,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -799,7 +799,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -854,7 +854,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -915,7 +915,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -976,7 +976,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1024,7 +1024,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1070,7 +1070,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1128,7 +1128,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1186,7 +1186,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1238,7 +1238,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1291,7 +1291,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1344,7 +1344,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1404,7 +1404,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1466,7 +1466,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1526,7 +1526,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1588,7 +1588,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1599,7 +1599,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1728,7 +1728,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1766,7 +1766,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1780,7 +1780,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1794,7 +1794,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1808,7 +1808,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1822,7 +1822,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1931,7 +1931,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1961,7 +1961,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2013,7 +2013,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2029,7 +2029,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2044,7 +2044,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2057,7 +2057,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2070,7 +2070,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2083,7 +2083,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2116,7 +2116,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2148,7 +2148,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2189,7 +2189,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2235,7 +2235,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2281,7 +2281,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2300,7 +2300,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2324,7 +2324,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2348,7 +2348,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2372,7 +2372,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2412,7 +2412,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2423,7 +2423,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2434,7 +2434,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2451,7 +2451,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2468,7 +2468,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2507,7 +2507,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2566,7 +2566,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2604,7 +2604,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2677,7 +2677,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2697,7 +2697,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2717,7 +2717,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2762,7 +2762,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2869,7 +2869,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2911,7 +2911,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2953,7 +2953,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2996,7 +2996,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3135,7 +3135,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3224,7 +3224,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3290,7 +3290,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3355,7 +3355,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3419,7 +3419,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3480,7 +3480,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3539,7 +3539,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3597,7 +3597,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3631,7 +3631,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3646,7 +3646,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3660,7 +3660,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3674,7 +3674,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3688,7 +3688,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3722,7 +3722,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3737,7 +3737,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3750,7 +3750,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3763,7 +3763,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3776,7 +3776,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.34.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.34.1.sql index 8fd4d74..12af1ed 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.34.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.34.1.sql @@ -36,4 +36,4 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.35.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.35.0.sql index 5ae8a23..28893c4 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.35.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.2--0.35.0.sql @@ -70,7 +70,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -138,7 +138,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, @@ -179,7 +179,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -218,4 +218,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.34.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.34.2.sql index 453f310..dfdb5d7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.34.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.34.2.sql @@ -66,7 +66,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -127,7 +127,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -188,7 +188,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -228,7 +228,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -267,7 +267,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -285,7 +285,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -302,7 +302,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -356,7 +356,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -413,7 +413,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -465,7 +465,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -520,7 +520,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -577,7 +577,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -632,7 +632,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -689,7 +689,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -744,7 +744,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -799,7 +799,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -854,7 +854,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -915,7 +915,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -976,7 +976,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1024,7 +1024,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1070,7 +1070,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1128,7 +1128,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1186,7 +1186,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1238,7 +1238,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1291,7 +1291,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1344,7 +1344,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1404,7 +1404,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1466,7 +1466,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1526,7 +1526,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1588,7 +1588,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1599,7 +1599,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1728,7 +1728,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1766,7 +1766,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1780,7 +1780,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1794,7 +1794,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1808,7 +1808,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1822,7 +1822,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1931,7 +1931,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1961,7 +1961,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2013,7 +2013,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2029,7 +2029,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2044,7 +2044,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2057,7 +2057,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2070,7 +2070,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2083,7 +2083,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2116,7 +2116,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2148,7 +2148,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2189,7 +2189,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2235,7 +2235,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2281,7 +2281,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2300,7 +2300,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2324,7 +2324,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2348,7 +2348,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2372,7 +2372,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2413,7 +2413,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2424,7 +2424,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2435,7 +2435,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2452,7 +2452,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2469,7 +2469,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2508,7 +2508,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2567,7 +2567,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2605,7 +2605,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2678,7 +2678,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2698,7 +2698,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2718,7 +2718,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2763,7 +2763,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2870,7 +2870,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2912,7 +2912,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2954,7 +2954,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2997,7 +2997,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3136,7 +3136,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3225,7 +3225,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3291,7 +3291,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3356,7 +3356,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3420,7 +3420,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3481,7 +3481,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3540,7 +3540,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3598,7 +3598,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3632,7 +3632,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3647,7 +3647,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3661,7 +3661,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3675,7 +3675,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3689,7 +3689,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3723,7 +3723,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3738,7 +3738,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3751,7 +3751,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3764,7 +3764,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3777,7 +3777,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.35.0--0.34.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.35.0--0.34.2.sql index bfbfae3..61ba329 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.35.0--0.34.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.35.0--0.34.2.sql @@ -64,7 +64,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -125,7 +125,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( @@ -167,7 +167,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -206,4 +206,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.35.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.35.0.sql index 4314dbc..acc54d7 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.35.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.35.0.sql @@ -72,7 +72,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -140,7 +140,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -201,7 +201,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -241,7 +241,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -280,7 +280,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -298,7 +298,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -315,7 +315,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -369,7 +369,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -426,7 +426,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -478,7 +478,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -533,7 +533,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -590,7 +590,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -645,7 +645,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -702,7 +702,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -757,7 +757,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -812,7 +812,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -867,7 +867,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -928,7 +928,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -989,7 +989,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1037,7 +1037,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1083,7 +1083,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1141,7 +1141,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1199,7 +1199,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1251,7 +1251,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1304,7 +1304,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1357,7 +1357,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1417,7 +1417,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1479,7 +1479,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1539,7 +1539,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1601,7 +1601,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1612,7 +1612,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1741,7 +1741,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1779,7 +1779,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1793,7 +1793,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1807,7 +1807,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1821,7 +1821,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1835,7 +1835,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1944,7 +1944,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1974,7 +1974,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2026,7 +2026,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2042,7 +2042,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2057,7 +2057,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2070,7 +2070,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2083,7 +2083,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2096,7 +2096,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2129,7 +2129,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2161,7 +2161,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2202,7 +2202,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2248,7 +2248,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2294,7 +2294,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2313,7 +2313,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2337,7 +2337,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2361,7 +2361,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2385,7 +2385,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2426,7 +2426,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2437,7 +2437,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2448,7 +2448,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2465,7 +2465,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2482,7 +2482,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2521,7 +2521,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2580,7 +2580,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2618,7 +2618,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2691,7 +2691,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2711,7 +2711,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2731,7 +2731,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2776,7 +2776,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2883,7 +2883,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2925,7 +2925,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2967,7 +2967,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3010,7 +3010,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3149,7 +3149,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3238,7 +3238,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3304,7 +3304,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3369,7 +3369,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3433,7 +3433,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3494,7 +3494,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3553,7 +3553,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3611,7 +3611,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3645,7 +3645,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3660,7 +3660,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3674,7 +3674,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3688,7 +3688,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3702,7 +3702,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3736,7 +3736,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3751,7 +3751,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3764,7 +3764,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3777,7 +3777,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3790,7 +3790,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.35.1--0.36.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.35.1--0.36.0.sql index 00ebeee..5055adc 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.35.1--0.36.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.35.1--0.36.0.sql @@ -38,7 +38,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocodio_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -52,7 +52,7 @@ RETURNS Geometry AS $$ geocodio_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_geocodio_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(geocodio_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_geocodio_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -100,7 +100,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Geocodio') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) @@ -138,7 +138,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_geocodio_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) @@ -156,7 +156,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', GeocodioGeocoderConfigBuilder, username, orgname, GD) geocoder = GeocodioBulkGeocoder(service_manager.config.geocodio_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -194,4 +194,4 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.35.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.35.1.sql index 080e7c5..8c41227 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.35.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.35.1.sql @@ -72,7 +72,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -140,7 +140,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -201,7 +201,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -241,7 +241,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -280,7 +280,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -298,7 +298,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -315,7 +315,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -369,7 +369,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -426,7 +426,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -478,7 +478,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -533,7 +533,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -590,7 +590,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -645,7 +645,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -702,7 +702,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -757,7 +757,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -812,7 +812,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -867,7 +867,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -928,7 +928,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -989,7 +989,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1037,7 +1037,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1083,7 +1083,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1141,7 +1141,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1199,7 +1199,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1251,7 +1251,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1304,7 +1304,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1357,7 +1357,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1417,7 +1417,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1479,7 +1479,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1539,7 +1539,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1601,7 +1601,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1612,7 +1612,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1741,7 +1741,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1779,7 +1779,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1793,7 +1793,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1807,7 +1807,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1821,7 +1821,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1835,7 +1835,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1944,7 +1944,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1974,7 +1974,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2026,7 +2026,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2042,7 +2042,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2057,7 +2057,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2070,7 +2070,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2083,7 +2083,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2096,7 +2096,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2129,7 +2129,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2161,7 +2161,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2202,7 +2202,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2248,7 +2248,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2294,7 +2294,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2313,7 +2313,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2337,7 +2337,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2361,7 +2361,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2385,7 +2385,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2426,7 +2426,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2437,7 +2437,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2448,7 +2448,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2465,7 +2465,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2482,7 +2482,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ @@ -2521,7 +2521,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2580,7 +2580,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2618,7 +2618,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2691,7 +2691,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2711,7 +2711,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2731,7 +2731,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2776,7 +2776,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2883,7 +2883,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -2925,7 +2925,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -2967,7 +2967,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3010,7 +3010,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3149,7 +3149,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3238,7 +3238,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3304,7 +3304,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3369,7 +3369,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3433,7 +3433,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3494,7 +3494,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3553,7 +3553,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3611,7 +3611,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3645,7 +3645,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3660,7 +3660,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3674,7 +3674,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3688,7 +3688,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3702,7 +3702,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3736,7 +3736,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3751,7 +3751,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3764,7 +3764,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3777,7 +3777,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3790,7 +3790,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.36.0--0.35.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.36.0--0.35.1.sql index 843776c..b9f5277 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.36.0--0.35.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.36.0--0.35.1.sql @@ -35,7 +35,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server.cdb_geocodio_geocode_street_point; @@ -74,6 +74,6 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DROP FUNCTION IF EXISTS cdb_dataservices_server._cdb_bulk_geocodio_geocode_street_point; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.36.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.36.0.sql index c843256..7e34397 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.36.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.36.0.sql @@ -72,7 +72,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate Mapbox routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints( username TEXT, @@ -140,7 +140,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate TomTom routing') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints( username TEXT, @@ -201,7 +201,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ raise Exception('Error trying to calculate mapzen routing') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -241,7 +241,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints( @@ -280,7 +280,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ return [result[0]['shape'],result[0]['length'], result[0]['duration']] else: raise Exception('Requested routing method is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- Get the connection to redis from cache or create a new one CREATE OR REPLACE FUNCTION cdb_dataservices_server._connect_to_redis(user_id text) RETURNS boolean AS $$ @@ -298,7 +298,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- -- Observatory connection config -- @@ -315,7 +315,7 @@ RETURNS text AS $$ user_obs_config = GD["user_obs_config_{0}".format(username)] return user_obs_config.connection_str -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, @@ -369,7 +369,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot( username TEXT, @@ -426,7 +426,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to obs_get_demographic_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON( username TEXT, @@ -478,7 +478,7 @@ RETURNS json AS $$ raise Exception('Error trying to obs_get_segment_snapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot( username TEXT, @@ -533,7 +533,7 @@ RETURNS SETOF JSON AS $$ raise Exception('Error trying to OBS_GetSegmentSnapshot') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure( username TEXT, @@ -590,7 +590,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory( username TEXT, @@ -645,7 +645,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure( username TEXT, @@ -702,7 +702,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetUSCensusMeasure') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory( username TEXT, @@ -757,7 +757,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetUSCensusCategory') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation( username TEXT, @@ -812,7 +812,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetPopulation') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById( username TEXT, @@ -867,7 +867,7 @@ RETURNS NUMERIC AS $$ raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -928,7 +928,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomvals)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData( username TEXT, @@ -989,7 +989,7 @@ RETURNS TABLE ( raise Exception('Error trying to OBS_GetData') finally: quota_service.increment_total_service_use(len(geomrefs)) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta( username TEXT, @@ -1037,7 +1037,7 @@ RETURNS JSON AS $$ 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; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation( username TEXT, @@ -1083,7 +1083,7 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$ import sys logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname}) raise Exception('Error trying to OBS_MetadataValidation') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_Search( username TEXT, orgname TEXT, @@ -1141,7 +1141,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text) raise Exception('Error trying to OBS_Search') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries( username TEXT, @@ -1199,7 +1199,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text raise Exception('Error trying to OBS_GetMeasureById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundary( username TEXT, orgname TEXT, @@ -1251,7 +1251,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundary') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId( username TEXT, @@ -1304,7 +1304,7 @@ RETURNS TEXT AS $$ raise Exception('Error trying to OBS_GetBoundaryId') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById( username TEXT, @@ -1357,7 +1357,7 @@ RETURNS geometry(Geometry, 4326) AS $$ raise Exception('Error trying to OBS_GetBoundaryById') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry( username TEXT, @@ -1417,7 +1417,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius( username TEXT, @@ -1479,7 +1479,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry( username TEXT, @@ -1539,7 +1539,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByGeometry') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius( username TEXT, @@ -1601,7 +1601,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ raise Exception('Error trying to OBS_GetPointsByPointAndRadius') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); @@ -1612,7 +1612,7 @@ RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ return plpy.execute("SELECT * FROM cdb_dataservices_server.__DST_ConnectUserTable({username}::text, {orgname}::text, {user_db_role}::text, {schema}::text, {dbname}::text, {host_addr}::text, {table_name}::text)" .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), user_db_role=plpy.quote_literal(user_db_role), schema=plpy.quote_literal(input_schema), dbname=plpy.quote_literal(dbname), table_name=plpy.quote_literal(table_name), host_addr=plpy.quote_literal(host_addr)) )[0] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.__DST_ConnectUserTable(username text, orgname text, user_db_role text, input_schema text, dbname text, host_addr text, table_name text) RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$ @@ -1741,7 +1741,7 @@ RETURNS boolean AS $$ logger_config = LoggerConfig(plpy) GD[cache_key] = logger_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; -- This is done in order to avoid an undesired depedency on cartodb extension CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text) @@ -1779,7 +1779,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1793,7 +1793,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1807,7 +1807,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1821,7 +1821,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1835,7 +1835,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type inner join pg_namespace ON (pg_type.typnamespace = pg_namespace.oid) @@ -1944,7 +1944,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$ ret += [[service, monthly_quota, used_quota, soft_limit, provider]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch( @@ -1974,7 +1974,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info_batch AS $$ ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]] return ret -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( username TEXT, @@ -2029,7 +2029,7 @@ RETURNS Geometry AS $$ else: raise Exception('Requested geocoder is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) @@ -2045,7 +2045,7 @@ RETURNS Geometry AS $$ else: raise Exception('Here geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2060,7 +2060,7 @@ RETURNS Geometry AS $$ else: raise Exception('Google geocoder is not available for your account.') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2073,7 +2073,7 @@ RETURNS Geometry AS $$ mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapzen_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2086,7 +2086,7 @@ RETURNS Geometry AS $$ mapbox_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapbox_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(mapbox_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2099,7 +2099,7 @@ RETURNS Geometry AS $$ tomtom_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_tomtom_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(tomtom_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocodio_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2112,7 +2112,7 @@ RETURNS Geometry AS $$ geocodio_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_geocodio_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(geocodio_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2145,7 +2145,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using here maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_google_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2177,7 +2177,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using google maps') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2218,7 +2218,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using mapzen') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2264,7 +2264,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Mapbox') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2310,7 +2310,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using TomTom') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_geocodio_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -2356,7 +2356,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode street point using Geocodio') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_get_rate_limit( username TEXT, @@ -2375,7 +2375,7 @@ RETURNS JSON AS $$ return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period}) else: return None -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit( username TEXT, @@ -2399,7 +2399,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_user_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit( username TEXT, @@ -2423,7 +2423,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_org_rate_limits(config) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit( username TEXT, @@ -2447,7 +2447,7 @@ RETURNS VOID AS $$ period = None config = RateLimitsConfig(service=service, username=username, limit=limit, period=period) config_setter.set_server_rate_limits(config) -$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; +$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE; -- TODO: could cartodb_id be replaced by rowid, maybe needing extra care for offset? CREATE TYPE cdb_dataservices_server.geocoding AS ( cartodb_id integer, @@ -2490,7 +2490,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"]) return plpy.execute(plan, [username, orgname, searches]) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_google_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2501,7 +2501,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_heremaps_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2512,7 +2512,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = LegacyServiceManager('geocoder', username, orgname, GD) geocoder = HereMapsBulkGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_tomtom_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2529,7 +2529,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD) geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_mapbox_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2546,7 +2546,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD) geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_bulk_geocodio_geocode_street_point(username TEXT, orgname TEXT, searches jsonb) RETURNS SETOF cdb_dataservices_server.geocoding AS $$ @@ -2563,7 +2563,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$ service_manager = ServiceManager('geocoder', GeocodioGeocoderConfigBuilder, username, orgname, GD) geocoder = GeocodioBulkGeocoder(service_manager.config.geocodio_api_key, service_manager.logger, service_manager.config.service_params) return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches) -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ from cartodb_services.metrics import QuotaService @@ -2601,7 +2601,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin0 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2660,7 +2660,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_admin1_polygon(admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) @@ -2698,7 +2698,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode admin1 polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2771,7 +2771,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) @@ -2791,7 +2791,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; ---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) @@ -2811,7 +2811,7 @@ RETURNS Geometry AS $$ logger.error('Error geocoding namedplace using geocode street point, falling back to internal geocoder', sys.exc_info(), data={"username": username, "orgname": orgname}) internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"]) return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point'] -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_internal_geocode_namedplace(username text, orgname text, city_name text, admin1_name text DEFAULT NULL, country_name text DEFAULT NULL) RETURNS Geometry AS $$ @@ -2856,7 +2856,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode namedplace point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -2963,7 +2963,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3005,7 +3005,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code point') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3047,7 +3047,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ @@ -3090,7 +3090,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ @@ -3229,7 +3229,7 @@ RETURNS Geometry AS $$ raise Exception('Error trying to geocode postal code polygon') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -------------------------------------------------------------------------------- @@ -3318,7 +3318,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance( username TEXT, @@ -3384,7 +3384,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isolines') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance( username TEXT, @@ -3449,7 +3449,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance( username TEXT, @@ -3513,7 +3513,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isolines') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones( username TEXT, @@ -3574,7 +3574,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get mapzen isochrones') finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones( username TEXT, @@ -3633,7 +3633,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get Mapbox isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones( username TEXT, @@ -3691,7 +3691,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ raise Exception('Error trying to get TomTom isochrones') finally: service_manager.quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3725,7 +3725,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3740,7 +3740,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3754,7 +3754,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3768,7 +3768,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isodistance CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3782,7 +3782,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ from cartodb_services.metrics import metrics @@ -3816,7 +3816,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) else: raise Exception('Requested isolines provider is not available') -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- heremaps isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_here_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3831,7 +3831,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapzen isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapzen_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3844,7 +3844,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapzen_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapzen_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- mapbox isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_mapbox_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3857,7 +3857,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ mapbox_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_mapbox_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; -- tomtom isochrone CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_tomtom_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) @@ -3870,7 +3870,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ tomtom_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._cdb_tomtom_isochrones($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options]) return result -$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED; +$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED; DO $$ BEGIN IF NOT EXISTS ( diff --git a/server/extension/old_versions/cdb_dataservices_server--0.4.0--0.5.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.4.0--0.5.0.sql index fedc7df..57699ff 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.4.0--0.5.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.4.0--0.5.0.sql @@ -56,7 +56,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Mapzen routing integration @@ -86,7 +86,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, username, orgname, mapzen_app_key) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_point_to_point( username TEXT, @@ -135,7 +135,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.4.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.4.0.sql index 5aa3aac..7a22e95 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.4.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.4.0.sql @@ -57,7 +57,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -82,7 +82,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -108,7 +108,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -857,7 +857,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.4.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.4.0.sql index 17d9203..dfd75be 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.4.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.4.0.sql @@ -51,7 +51,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Mapzen integration diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.5.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.5.1.sql index 5990add..36f184a 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.5.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.0--0.5.1.sql @@ -20,7 +20,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -34,7 +34,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) @@ -49,7 +49,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -63,7 +63,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -77,7 +77,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -548,7 +548,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_point_to_point( username TEXT, @@ -597,4 +597,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.0.sql index ccbc582..1ce6c73 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.0.sql @@ -55,7 +55,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -135,7 +135,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -160,7 +160,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -186,7 +186,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -210,7 +210,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -959,7 +959,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.0.sql index b869df7..fb1e61c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.0.sql @@ -63,7 +63,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) @@ -89,7 +89,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -115,7 +115,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -139,7 +139,7 @@ RETURNS boolean AS $$ # --for this user session but... GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_here_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -599,7 +599,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_point_to_point( username TEXT, @@ -648,4 +648,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_geocoder_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.2.sql index 07f413e..b5b8026 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.1--0.5.2.sql @@ -58,4 +58,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.1.sql index 04f4b16..8dddb3c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.1.sql @@ -55,7 +55,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -91,7 +91,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -105,7 +105,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) @@ -120,7 +120,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -135,7 +135,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -150,7 +150,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -910,7 +910,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.2--0.5.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.2--0.5.1.sql index 1a93f61..2378f9f 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.2--0.5.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.2--0.5.1.sql @@ -48,4 +48,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.5.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.5.2.sql index 1c621bf..8d284cc 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.5.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.5.2.sql @@ -59,7 +59,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -95,7 +95,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -109,7 +109,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) @@ -124,7 +124,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -139,7 +139,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -154,7 +154,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -914,7 +914,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.6.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.6.0.sql index d70af80..b10f05c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.6.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.6.0.sql @@ -65,7 +65,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -101,7 +101,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -115,7 +115,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) @@ -130,7 +130,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -145,7 +145,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -160,7 +160,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -954,7 +954,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.6.1--0.6.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.6.1--0.6.2.sql index b749c0a..d37789e 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.6.1--0.6.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.6.1--0.6.2.sql @@ -99,4 +99,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.6.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.6.1.sql index bd8d743..7b52f71 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.6.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.6.1.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -117,7 +117,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) @@ -132,7 +132,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -147,7 +147,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -162,7 +162,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -961,7 +961,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.6.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.6.1.sql index f09abda..4d27628 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.6.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.6.1.sql @@ -95,4 +95,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.7.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.7.0.sql index 7edf6f4..09ec3a9 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.7.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.6.2--0.7.0.sql @@ -13,7 +13,7 @@ RETURNS boolean AS $$ data_observatory_config = DataObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = data_observatory_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.6.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.6.2.sql index 506c69d..27c47e5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.6.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.6.2.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -117,7 +117,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) @@ -132,7 +132,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) @@ -147,7 +147,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Get the Redis configuration from the _conf table -- CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) @@ -162,7 +162,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -964,7 +964,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.0--0.7.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.0--0.7.1.sql index 0c4a66d..05542d0 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.0--0.7.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.0--0.7.1.sql @@ -14,7 +14,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.0.sql index 31a4230..ffe6f85 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.0.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, orgname TEXT, @@ -191,7 +191,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -205,7 +205,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -219,7 +219,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -233,7 +233,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_data_observatory_config(username text, orgname text) RETURNS boolean AS $$ @@ -247,7 +247,7 @@ RETURNS boolean AS $$ data_observatory_config = DataObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = data_observatory_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1049,7 +1049,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.1--0.7.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.1--0.7.0.sql index c8b04ed..cbad911 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.1--0.7.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.1--0.7.0.sql @@ -14,7 +14,7 @@ RETURNS boolean AS $$ data_observatory_config = DataObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = data_observatory_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.1.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.1.sql index 8c38d2b..73a7670 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.1.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.1.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.obs_get_demographic_snapshot( username TEXT, orgname TEXT, @@ -191,7 +191,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -205,7 +205,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -219,7 +219,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -233,7 +233,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -247,7 +247,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1049,7 +1049,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.2.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.2.sql index eb30916..493f271 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.2.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.2.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -231,7 +231,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -245,7 +245,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -259,7 +259,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -273,7 +273,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -287,7 +287,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1089,7 +1089,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.3--0.7.4.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.3--0.7.4.sql index f6e12ff..5b8ded5 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.3--0.7.4.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.3--0.7.4.sql @@ -54,4 +54,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.3.sql index 1f9fc97..810d474 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.3.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -231,7 +231,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -245,7 +245,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -259,7 +259,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -273,7 +273,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -287,7 +287,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1089,7 +1089,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.7.3.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.7.3.sql index 274e74e..303d01c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.7.3.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.7.3.sql @@ -53,4 +53,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; \ No newline at end of file diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.8.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.8.0.sql index 718f858..8f7d4af 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.8.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.4--0.8.0.sql @@ -16,7 +16,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.7.4.sql b/server/extension/old_versions/cdb_dataservices_server--0.7.4.sql index 7f7f308..8b39b32 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.7.4.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.7.4.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -231,7 +231,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -245,7 +245,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -259,7 +259,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -273,7 +273,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -287,7 +287,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1090,7 +1090,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.8.0--0.9.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.8.0--0.9.0.sql index 4d8bc1a..1fd487c 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.8.0--0.9.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.8.0--0.9.0.sql @@ -77,7 +77,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.8.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.8.0.sql index fe71923..7c2f2e3 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.8.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.8.0.sql @@ -67,7 +67,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -103,7 +103,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -978,7 +978,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -992,7 +992,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1006,7 +1006,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1020,7 +1020,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1034,7 +1034,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1048,7 +1048,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1851,7 +1851,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) diff --git a/server/extension/old_versions/cdb_dataservices_server--0.9.0--0.8.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.9.0--0.8.0.sql index 21e434f..a4ad981 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.9.0--0.8.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.9.0--0.8.0.sql @@ -64,7 +64,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, diff --git a/server/extension/old_versions/cdb_dataservices_server--0.9.0.sql b/server/extension/old_versions/cdb_dataservices_server--0.9.0.sql index 6d21b2d..e082f80 100644 --- a/server/extension/old_versions/cdb_dataservices_server--0.9.0.sql +++ b/server/extension/old_versions/cdb_dataservices_server--0.9.0.sql @@ -63,7 +63,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point( username TEXT, orgname TEXT, @@ -119,7 +119,7 @@ RETURNS boolean AS $$ 'redis_metrics_connection': redis_metrics_connection, } return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- -- Observatory connection config -- @@ -1092,7 +1092,7 @@ RETURNS boolean AS $$ geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text) RETURNS boolean AS $$ @@ -1106,7 +1106,7 @@ RETURNS boolean AS $$ geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname) GD[cache_key] = geocoder_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1120,7 +1120,7 @@ RETURNS boolean AS $$ isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = isolines_routing_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text) RETURNS boolean AS $$ @@ -1134,7 +1134,7 @@ RETURNS boolean AS $$ routing_config = RoutingConfig(redis_conn, plpy, username, orgname) GD[cache_key] = routing_config 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 $$ @@ -1148,7 +1148,7 @@ RETURNS boolean AS $$ obs_snapshot_config = ObservatorySnapshotConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_snapshot_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text) RETURNS boolean AS $$ @@ -1162,7 +1162,7 @@ RETURNS boolean AS $$ obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname) GD[cache_key] = obs_config return True -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; -- Geocodes a street address given a searchtext and a state and/or country CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point(username TEXT, orgname TEXT, searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL) RETURNS Geometry AS $$ @@ -1965,7 +1965,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.error(error_msg) finally: quota_service.increment_total_service_use() -$$ LANGUAGE plpythonu SECURITY DEFINER; +$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER; CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[]) RETURNS SETOF cdb_dataservices_server.isoline AS $$ plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username)) From 9b95682243064c0795d030d047d0fc66b85fa090 Mon Sep 17 00:00:00 2001 From: manmorjim Date: Tue, 10 Mar 2020 17:18:55 +0100 Subject: [PATCH 2/5] Add `@@plpythonu@@` vars into old_versions --- .../old_versions/cdb_dataservices_client--0.10.0--0.10.1.sql | 2 +- client/old_versions/cdb_dataservices_client--0.10.0.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.10.1--0.10.0.sql | 2 +- client/old_versions/cdb_dataservices_client--0.10.1.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.10.2--0.11.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.10.2.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.11.0--0.10.2.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.11.0--0.11.1.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.11.0.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.11.1--0.11.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.11.1.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.12.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.12.1.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.13.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.14.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.14.1.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.15.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.16.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.17.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.18.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.19.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.20.0.sql | 4 ++-- client/old_versions/cdb_dataservices_client--0.21.0.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.22.0--0.21.0.sql | 4 ++-- .../old_versions/cdb_dataservices_client--0.9.0--0.10.0.sql | 4 ++-- 25 files changed, 48 insertions(+), 48 deletions(-) diff --git a/client/old_versions/cdb_dataservices_client--0.10.0--0.10.1.sql b/client/old_versions/cdb_dataservices_client--0.10.0--0.10.1.sql index 8e24d11..4209ee5 100644 --- a/client/old_versions/cdb_dataservices_client--0.10.0--0.10.1.sql +++ b/client/old_versions/cdb_dataservices_client--0.10.0--0.10.1.sql @@ -93,4 +93,4 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@; \ No newline at end of file diff --git a/client/old_versions/cdb_dataservices_client--0.10.0.sql b/client/old_versions/cdb_dataservices_client--0.10.0.sql index a1b8fff..b3afeab 100644 --- a/client/old_versions/cdb_dataservices_client--0.10.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.10.0.sql @@ -1277,7 +1277,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; @@ -1352,7 +1352,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._OBS_ConnectUserTable(username text, orgname text, user_db_role text, user_schema text, dbname text, table_name text) diff --git a/client/old_versions/cdb_dataservices_client--0.10.1--0.10.0.sql b/client/old_versions/cdb_dataservices_client--0.10.1--0.10.0.sql index 5aebf7c..87168da 100644 --- a/client/old_versions/cdb_dataservices_client--0.10.1--0.10.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.10.1--0.10.0.sql @@ -88,4 +88,4 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; \ No newline at end of file +$$ LANGUAGE @@plpythonu@@; \ No newline at end of file diff --git a/client/old_versions/cdb_dataservices_client--0.10.1.sql b/client/old_versions/cdb_dataservices_client--0.10.1.sql index 274ed68..023722c 100644 --- a/client/old_versions/cdb_dataservices_client--0.10.1.sql +++ b/client/old_versions/cdb_dataservices_client--0.10.1.sql @@ -1282,7 +1282,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; @@ -1357,7 +1357,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._OBS_ConnectUserTable(username text, orgname text, user_db_role text, user_schema text, dbname text, table_name text) diff --git a/client/old_versions/cdb_dataservices_client--0.10.2--0.11.0.sql b/client/old_versions/cdb_dataservices_client--0.10.2--0.11.0.sql index 9d735a1..481bdd2 100644 --- a/client/old_versions/cdb_dataservices_client--0.10.2--0.11.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.10.2--0.11.0.sql @@ -144,7 +144,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -237,7 +237,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.10.2.sql b/client/old_versions/cdb_dataservices_client--0.10.2.sql index f003137..2368198 100644 --- a/client/old_versions/cdb_dataservices_client--0.10.2.sql +++ b/client/old_versions/cdb_dataservices_client--0.10.2.sql @@ -1282,7 +1282,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; @@ -1357,7 +1357,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._OBS_ConnectUserTable(username text, orgname text, user_db_role text, user_schema text, dbname text, table_name text) diff --git a/client/old_versions/cdb_dataservices_client--0.11.0--0.10.2.sql b/client/old_versions/cdb_dataservices_client--0.11.0--0.10.2.sql index 7bebfd9..034a513 100644 --- a/client/old_versions/cdb_dataservices_client--0.11.0--0.10.2.sql +++ b/client/old_versions/cdb_dataservices_client--0.11.0--0.10.2.sql @@ -175,7 +175,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; @@ -250,7 +250,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._OBS_ConnectUserTable(username text, orgname text, user_db_role text, user_schema text, dbname text, table_name text) diff --git a/client/old_versions/cdb_dataservices_client--0.11.0--0.11.1.sql b/client/old_versions/cdb_dataservices_client--0.11.0--0.11.1.sql index 0e60587..a4cea79 100644 --- a/client/old_versions/cdb_dataservices_client--0.11.0--0.11.1.sql +++ b/client/old_versions/cdb_dataservices_client--0.11.0--0.11.1.sql @@ -44,7 +44,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -137,4 +137,4 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; diff --git a/client/old_versions/cdb_dataservices_client--0.11.0.sql b/client/old_versions/cdb_dataservices_client--0.11.0.sql index 671069d..cf3aaaf 100644 --- a/client/old_versions/cdb_dataservices_client--0.11.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.11.0.sql @@ -1251,7 +1251,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1344,7 +1344,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.11.1--0.11.0.sql b/client/old_versions/cdb_dataservices_client--0.11.1--0.11.0.sql index d44d30c..294db98 100644 --- a/client/old_versions/cdb_dataservices_client--0.11.1--0.11.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.11.1--0.11.0.sql @@ -44,7 +44,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -137,4 +137,4 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; diff --git a/client/old_versions/cdb_dataservices_client--0.11.1.sql b/client/old_versions/cdb_dataservices_client--0.11.1.sql index 05b6b34..c8092ac 100644 --- a/client/old_versions/cdb_dataservices_client--0.11.1.sql +++ b/client/old_versions/cdb_dataservices_client--0.11.1.sql @@ -1251,7 +1251,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1344,7 +1344,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.12.0.sql b/client/old_versions/cdb_dataservices_client--0.12.0.sql index d0711cb..7ac7c5c 100644 --- a/client/old_versions/cdb_dataservices_client--0.12.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.12.0.sql @@ -1396,7 +1396,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1489,7 +1489,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.12.1.sql b/client/old_versions/cdb_dataservices_client--0.12.1.sql index ee27ce0..ca1cdd3 100644 --- a/client/old_versions/cdb_dataservices_client--0.12.1.sql +++ b/client/old_versions/cdb_dataservices_client--0.12.1.sql @@ -1396,7 +1396,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1489,7 +1489,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.13.0.sql b/client/old_versions/cdb_dataservices_client--0.13.0.sql index 219bc19..1ebb774 100644 --- a/client/old_versions/cdb_dataservices_client--0.13.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.13.0.sql @@ -1467,7 +1467,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1560,7 +1560,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.14.0.sql b/client/old_versions/cdb_dataservices_client--0.14.0.sql index 682a4f1..5cded17 100644 --- a/client/old_versions/cdb_dataservices_client--0.14.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.14.0.sql @@ -1467,7 +1467,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1560,7 +1560,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.14.1.sql b/client/old_versions/cdb_dataservices_client--0.14.1.sql index df980e3..2f9ee84 100644 --- a/client/old_versions/cdb_dataservices_client--0.14.1.sql +++ b/client/old_versions/cdb_dataservices_client--0.14.1.sql @@ -1470,7 +1470,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1563,7 +1563,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.15.0.sql b/client/old_versions/cdb_dataservices_client--0.15.0.sql index 66c3621..0f9e647 100644 --- a/client/old_versions/cdb_dataservices_client--0.15.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.15.0.sql @@ -1551,7 +1551,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1644,7 +1644,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.16.0.sql b/client/old_versions/cdb_dataservices_client--0.16.0.sql index 248c0cd..40dfbbc 100644 --- a/client/old_versions/cdb_dataservices_client--0.16.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.16.0.sql @@ -1550,7 +1550,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1643,7 +1643,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.17.0.sql b/client/old_versions/cdb_dataservices_client--0.17.0.sql index 124aaef..eb73a15 100644 --- a/client/old_versions/cdb_dataservices_client--0.17.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.17.0.sql @@ -1550,7 +1550,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1643,7 +1643,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.18.0.sql b/client/old_versions/cdb_dataservices_client--0.18.0.sql index a4a2574..9b79ac8 100644 --- a/client/old_versions/cdb_dataservices_client--0.18.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.18.0.sql @@ -1600,7 +1600,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1693,7 +1693,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.19.0.sql b/client/old_versions/cdb_dataservices_client--0.19.0.sql index 93865fe..453b329 100644 --- a/client/old_versions/cdb_dataservices_client--0.19.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.19.0.sql @@ -1625,7 +1625,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1718,7 +1718,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.20.0.sql b/client/old_versions/cdb_dataservices_client--0.20.0.sql index c968a53..2b35cad 100644 --- a/client/old_versions/cdb_dataservices_client--0.20.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.20.0.sql @@ -1650,7 +1650,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1743,7 +1743,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.21.0.sql b/client/old_versions/cdb_dataservices_client--0.21.0.sql index b6bdb9f..2d70aa3 100644 --- a/client/old_versions/cdb_dataservices_client--0.21.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.21.0.sql @@ -1650,7 +1650,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1743,7 +1743,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.22.0--0.21.0.sql b/client/old_versions/cdb_dataservices_client--0.22.0--0.21.0.sql index 51d5949..479bd19 100644 --- a/client/old_versions/cdb_dataservices_client--0.22.0--0.21.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.22.0--0.21.0.sql @@ -1610,7 +1610,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas ) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure( username text, @@ -1703,7 +1703,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea fdw_server=plpy.quote_literal(server_name))) return True -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable( username text, diff --git a/client/old_versions/cdb_dataservices_client--0.9.0--0.10.0.sql b/client/old_versions/cdb_dataservices_client--0.9.0--0.10.0.sql index 35b03d8..94cc398 100644 --- a/client/old_versions/cdb_dataservices_client--0.9.0--0.10.0.sql +++ b/client/old_versions/cdb_dataservices_client--0.9.0--0.10.0.sql @@ -164,7 +164,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; @@ -239,7 +239,7 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) return False -$$ LANGUAGE plpythonu; +$$ LANGUAGE @@plpythonu@@; CREATE OR REPLACE FUNCTION cdb_dataservices_client._OBS_ConnectUserTable(username text, orgname text, user_db_role text, user_schema text, dbname text, table_name text) From 0a902d7f00ee19058d09990a6f55e514e46540da Mon Sep 17 00:00:00 2001 From: manmorjim Date: Tue, 10 Mar 2020 17:19:19 +0100 Subject: [PATCH 3/5] Replace `@@plpythonu@@` vars --- client/Makefile | 67 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/client/Makefile b/client/Makefile index 8f2260d..36f37fd 100644 --- a/client/Makefile +++ b/client/Makefile @@ -35,7 +35,7 @@ SOURCES_DATA_DIR = sql/ REGRESS = $(notdir $(basename $(sort $(wildcard test/sql/*test.sql)))) REGRESS_EXPEC = $(notdir $(basename $(sort $(wildcard test/expected/*test.out)))) -TEST_DIR = test_out +TEST_DIR = test REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)' --user='postgres' # DATA is a special variable used by postgres build infrastructure @@ -95,10 +95,8 @@ release: $(EXTENSION).control $(SOURCES_DATA) devclean: rm -f $(NEW_EXTENSION_ARTIFACT) rm -f $(GENERATED_SQL_FILES) - rm -rf $(TEST_DIR) - for f in $(basename $(wildcard old_versions/*.bak)); do \ - mv $${f}.bak $${f}; \ - done + +clean: restore_copies # If needed remove PARALLEL tags from the release files release_remove_parallel_deploy: @@ -110,25 +108,54 @@ ifeq ($(PG_PARALLEL), 0) done endif +restore_copies: + # tests + for f in $(basename $(wildcard test/sql/*.copy)); do \ + cat $${f}.copy > $${f}; \ + done + for f in $(basename $(wildcard test/expected/*.copy)); do \ + cat $${f}.copy > $${f}; \ + done + rm -f test/sql/*.copy; + rm -f test/expected/*.copy; + # data + for f in $(basename $(wildcard sql/*.copy)); do \ + cat $${f}.copy > $${f}; \ + done + rm -f sql/*.copy; + # old_versions + for f in $(basename $(wildcard old_versions/*.copy)); do \ + cat $${f}.copy > $${f}; \ + done + rm -f old_versions/*.copy; + # current scripts + for f in $(basename $(wildcard *.copy)); do \ + cat $${f}.copy > $${f}; \ + done + rm -f *.copy; + # Replacing variables defined within test files -replace_variables: - mkdir -p $(TEST_DIR) - mkdir -p $(TEST_DIR)/expected - mkdir -p $(TEST_DIR)/sql - for f in $(REGRESS); do \ - cat test/sql/$${f}.sql | \ - sed -e 's/@@plpythonu@@/$(PLPYTHONU)/g' \ - >> $(TEST_DIR)/sql/$${f}.sql; \ +replace_variables: restore_copies + # tests + for f in $(sort $(wildcard test/sql/*test.sql)); do \ + sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ done - for f in $(REGRESS_EXPEC); do \ - cat test/expected/$${f}.out | \ - sed -e 's/@@plpythonu@@/$(PLPYTHONU)/g' \ - >> $(TEST_DIR)/expected/$${f}.out; \ + for f in $(sort $(wildcard test/expected/*test.out)); do \ + sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ done - for f in $(basename $(wildcard old_versions/*.bak)); do \ - mv $${f}.bak $${f}; \ - sed --in-place=.bak -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ + # data + for f in $(wildcard sql/*.sql); do \ + sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ done + # old_versions + for f in $(wildcard old_versions/*.sql); do \ + sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ + done + # current scripts + for f in $(wildcard *.sql); do \ + sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \ + done + sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $(EXTENSION).control; # Install the current release into the PostgreSQL extensions directory deploy: release_remove_parallel_deploy From 40d1b4eafd94c278e49e33dc0039b39fff8d8290 Mon Sep 17 00:00:00 2001 From: manmorjim Date: Tue, 10 Mar 2020 17:19:46 +0100 Subject: [PATCH 4/5] Update dependencies --- client/carto-package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/carto-package.json b/client/carto-package.json index ff0f618..e91da4e 100644 --- a/client/carto-package.json +++ b/client/carto-package.json @@ -4,7 +4,7 @@ "requires": { "postgresql": "^11.0.0", "postgis": "^2.5.0.0", - "carto_postgresql_ext": "^0.32.0" + "carto_postgresql_ext": "^0.36.0" }, "works_with": { } From 201ab42665300d7f556d1811b80caa0406571ac2 Mon Sep 17 00:00:00 2001 From: "Manuel J. Morillo" Date: Tue, 10 Mar 2020 17:24:17 +0100 Subject: [PATCH 5/5] Keep 0.38.0 version --- server/extension/cdb_dataservices_server.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/extension/cdb_dataservices_server.control b/server/extension/cdb_dataservices_server.control index 3e18400..c0d362e 100644 --- a/server/extension/cdb_dataservices_server.control +++ b/server/extension/cdb_dataservices_server.control @@ -1,5 +1,5 @@ comment = 'CartoDB dataservices server extension' -default_version = '0.37.0' +default_version = '0.38.0' requires = '@@plpythonu@@, plproxy, postgis, cdb_geocoder' superuser = true schema = cdb_dataservices_server