parent
a90391aeef
commit
dd907ac2bc
@ -14,6 +14,14 @@ AWK = awk
|
|||||||
PG_CONFIG = pg_config
|
PG_CONFIG = pg_config
|
||||||
PG_PARALLEL := $(shell $(PG_CONFIG) --version | ($(AWK) '{$$2*=1000; if ($$2 >= 9600) print 1; else print 0;}' 2> /dev/null || echo 0))
|
PG_PARALLEL := $(shell $(PG_CONFIG) --version | ($(AWK) '{$$2*=1000; if ($$2 >= 9600) print 1; else print 0;}' 2> /dev/null || echo 0))
|
||||||
|
|
||||||
|
# PG12 compatibility
|
||||||
|
PG_VERSION := $(shell $(PG_CONFIG) --version | $(AWK) '{split($$2,a,"."); print a[1]}')
|
||||||
|
PG_12_GE := $(shell [ $(PG_VERSION) -ge 12 ] && echo true)
|
||||||
|
PLPYTHONU := plpythonu
|
||||||
|
ifeq ($(PG_12_GE), true)
|
||||||
|
PLPYTHONU := plpython3u
|
||||||
|
endif
|
||||||
|
|
||||||
# OLD_VERSIONS = $(wildcard old_versions/*.sql)
|
# OLD_VERSIONS = $(wildcard old_versions/*.sql)
|
||||||
# DATA = $(NEW_EXTENSION_ARTIFACT) \
|
# DATA = $(NEW_EXTENSION_ARTIFACT) \
|
||||||
# $(OLD_VERSIONS) \
|
# $(OLD_VERSIONS) \
|
||||||
@ -25,9 +33,9 @@ DATA = $(NEW_EXTENSION_ARTIFACT) \
|
|||||||
$(OLD_VERSIONS)
|
$(OLD_VERSIONS)
|
||||||
SOURCES_DATA_DIR = sql/
|
SOURCES_DATA_DIR = sql/
|
||||||
|
|
||||||
|
|
||||||
REGRESS = $(notdir $(basename $(sort $(wildcard test/sql/*test.sql))))
|
REGRESS = $(notdir $(basename $(sort $(wildcard test/sql/*test.sql))))
|
||||||
TEST_DIR = test/
|
REGRESS_EXPEC = $(notdir $(basename $(sort $(wildcard test/expected/*test.out))))
|
||||||
|
TEST_DIR = test_re
|
||||||
REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)' --user='postgres'
|
REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)' --user='postgres'
|
||||||
|
|
||||||
# DATA is a special variable used by postgres build infrastructure
|
# DATA is a special variable used by postgres build infrastructure
|
||||||
@ -54,7 +62,8 @@ SOURCES_DATA = $(wildcard $(SOURCES_DATA_DIR)/*.sql) $(GENERATED_SQL_FILES)
|
|||||||
|
|
||||||
$(NEW_EXTENSION_ARTIFACT): $(SOURCES_DATA)
|
$(NEW_EXTENSION_ARTIFACT): $(SOURCES_DATA)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
cat $(SOURCES_DATA_DIR)/*.sql >> $@
|
cat $(SOURCES_DATA_DIR)/*.sql | \
|
||||||
|
$(SED) -e 's/@@plpythonu@@/$(PLPYTHONU)/g' >> $@
|
||||||
ifeq ($(PG_PARALLEL), 0)
|
ifeq ($(PG_PARALLEL), 0)
|
||||||
# Remove PARALLEL in aggregates and functions
|
# Remove PARALLEL in aggregates and functions
|
||||||
$(eval TMPFILE := $(shell mktemp /tmp/$(basename $0).XXXXXXXX))
|
$(eval TMPFILE := $(shell mktemp /tmp/$(basename $0).XXXXXXXX))
|
||||||
@ -86,6 +95,7 @@ release: $(EXTENSION).control $(SOURCES_DATA)
|
|||||||
devclean:
|
devclean:
|
||||||
rm -f $(NEW_EXTENSION_ARTIFACT)
|
rm -f $(NEW_EXTENSION_ARTIFACT)
|
||||||
rm -f $(GENERATED_SQL_FILES)
|
rm -f $(GENERATED_SQL_FILES)
|
||||||
|
rm -rf $(TEST_DIR)
|
||||||
|
|
||||||
# If needed remove PARALLEL tags from the release files
|
# If needed remove PARALLEL tags from the release files
|
||||||
release_remove_parallel_deploy:
|
release_remove_parallel_deploy:
|
||||||
@ -97,9 +107,25 @@ ifeq ($(PG_PARALLEL), 0)
|
|||||||
done
|
done
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
prepare_tests:
|
||||||
|
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; \
|
||||||
|
done
|
||||||
|
for f in $(REGRESS_EXPEC); do \
|
||||||
|
cat test/expected/$${f}.out | \
|
||||||
|
sed -e 's/@@plpythonu@@/$(PLPYTHONU)/g' \
|
||||||
|
>> $(TEST_DIR)/expected/$${f}.out; \
|
||||||
|
done
|
||||||
|
|
||||||
# Install the current release into the PostgreSQL extensions directory
|
# Install the current release into the PostgreSQL extensions directory
|
||||||
deploy: release_remove_parallel_deploy
|
deploy: release_remove_parallel_deploy
|
||||||
$(INSTALL_DATA) $(EXTENSION).control '$(DESTDIR)$(datadir)/extension/'
|
$(INSTALL_DATA) $(EXTENSION).control '$(DESTDIR)$(datadir)/extension/'
|
||||||
$(INSTALL_DATA) old_versions/*.sql *.sql '$(DESTDIR)$(datadir)/extension/'
|
$(INSTALL_DATA) old_versions/*.sql *.sql '$(DESTDIR)$(datadir)/extension/'
|
||||||
|
|
||||||
install: deploy
|
install: prepare_tests deploy
|
||||||
|
@ -138,7 +138,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PrepareTableOBS_GetMeas
|
|||||||
)
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMeasure(
|
||||||
username text,
|
username text,
|
||||||
@ -231,7 +231,7 @@ CREATE OR REPLACE FUNCTION cdb_dataservices_client.__DST_PopulateTableOBS_GetMea
|
|||||||
fdw_server=plpy.quote_literal(server_name)))
|
fdw_server=plpy.quote_literal(server_name)))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client._DST_ConnectUserTable(
|
||||||
username text,
|
username text,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
-- Install dependencies
|
-- Install dependencies
|
||||||
CREATE EXTENSION postgis;
|
CREATE EXTENSION postgis;
|
||||||
CREATE EXTENSION plpythonu;
|
CREATE EXTENSION @@plpythonu@@;
|
||||||
CREATE EXTENSION cartodb;
|
CREATE EXTENSION cartodb;
|
||||||
CREATE EXTENSION plproxy;
|
CREATE EXTENSION plproxy;
|
||||||
-- Install the extension
|
-- Install the extension
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
-- Install dependencies
|
-- Install dependencies
|
||||||
CREATE EXTENSION postgis;
|
CREATE EXTENSION postgis;
|
||||||
CREATE EXTENSION plpythonu;
|
CREATE EXTENSION @@plpythonu@@;
|
||||||
CREATE EXTENSION cartodb;
|
CREATE EXTENSION cartodb;
|
||||||
CREATE EXTENSION plproxy;
|
CREATE EXTENSION plproxy;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
comment = 'CartoDB dataservices server extension'
|
comment = 'CartoDB dataservices server extension'
|
||||||
default_version = '0.37.0'
|
default_version = '0.37.0'
|
||||||
requires = 'plpythonu, plproxy, postgis, cdb_geocoder'
|
requires = '@@plpythonu@@, plproxy, postgis, cdb_geocoder'
|
||||||
superuser = true
|
superuser = true
|
||||||
schema = cdb_dataservices_server
|
schema = cdb_dataservices_server
|
||||||
|
@ -69,7 +69,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$
|
|||||||
raise Exception('Error trying to calculate Mapbox routing')
|
raise Exception('Error trying to calculate Mapbox routing')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_route_with_waypoints(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -137,7 +137,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$
|
|||||||
raise Exception('Error trying to calculate TomTom routing')
|
raise Exception('Error trying to calculate TomTom routing')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_route_with_waypoints(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -198,4 +198,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$
|
|||||||
raise Exception('Error trying to calculate mapzen routing')
|
raise Exception('Error trying to calculate mapzen routing')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -37,7 +37,7 @@ RETURNS cdb_dataservices_server.simple_route AS $$
|
|||||||
return [result[0]['shape'],result[0]['length'], result[0]['duration']]
|
return [result[0]['shape'],result[0]['length'], result[0]['duration']]
|
||||||
else:
|
else:
|
||||||
raise Exception('Requested routing method is not available')
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_with_waypoints(
|
||||||
@ -76,4 +76,4 @@ RETURNS cdb_dataservices_server.simple_route AS $$
|
|||||||
return [result[0]['shape'],result[0]['length'], result[0]['duration']]
|
return [result[0]['shape'],result[0]['length'], result[0]['duration']]
|
||||||
else:
|
else:
|
||||||
raise Exception('Requested routing method is not available')
|
raise Exception('Requested routing method is not available')
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -15,4 +15,4 @@ RETURNS boolean AS $$
|
|||||||
'redis_metrics_connection': redis_metrics_connection,
|
'redis_metrics_connection': redis_metrics_connection,
|
||||||
}
|
}
|
||||||
return True
|
return True
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -14,7 +14,7 @@ RETURNS text AS $$
|
|||||||
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
||||||
|
|
||||||
return user_obs_config.connection_str
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshotJSON(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -68,7 +68,7 @@ RETURNS json AS $$
|
|||||||
raise Exception('Error trying to obs_get_demographic_snapshot')
|
raise Exception('Error trying to obs_get_demographic_snapshot')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetDemographicSnapshot(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -125,7 +125,7 @@ RETURNS SETOF JSON AS $$
|
|||||||
raise Exception('Error trying to obs_get_demographic_snapshot')
|
raise Exception('Error trying to obs_get_demographic_snapshot')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshotJSON(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -177,7 +177,7 @@ RETURNS json AS $$
|
|||||||
raise Exception('Error trying to obs_get_segment_snapshot')
|
raise Exception('Error trying to obs_get_segment_snapshot')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetSegmentSnapshot(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -232,7 +232,7 @@ RETURNS SETOF JSON AS $$
|
|||||||
raise Exception('Error trying to OBS_GetSegmentSnapshot')
|
raise Exception('Error trying to OBS_GetSegmentSnapshot')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasure(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -289,7 +289,7 @@ RETURNS NUMERIC AS $$
|
|||||||
raise Exception('Error trying to OBS_GetMeasure')
|
raise Exception('Error trying to OBS_GetMeasure')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetCategory(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -344,7 +344,7 @@ RETURNS TEXT AS $$
|
|||||||
raise Exception('Error trying to OBS_GetCategory')
|
raise Exception('Error trying to OBS_GetCategory')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusMeasure(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -401,7 +401,7 @@ RETURNS NUMERIC AS $$
|
|||||||
raise Exception('Error trying to OBS_GetUSCensusMeasure')
|
raise Exception('Error trying to OBS_GetUSCensusMeasure')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetUSCensusCategory(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -456,7 +456,7 @@ RETURNS TEXT AS $$
|
|||||||
raise Exception('Error trying to OBS_GetUSCensusCategory')
|
raise Exception('Error trying to OBS_GetUSCensusCategory')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPopulation(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -511,7 +511,7 @@ RETURNS NUMERIC AS $$
|
|||||||
raise Exception('Error trying to OBS_GetPopulation')
|
raise Exception('Error trying to OBS_GetPopulation')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeasureById(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -566,7 +566,7 @@ RETURNS NUMERIC AS $$
|
|||||||
raise Exception('Error trying to OBS_GetMeasureById')
|
raise Exception('Error trying to OBS_GetMeasureById')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -627,7 +627,7 @@ RETURNS TABLE (
|
|||||||
raise Exception('Error trying to OBS_GetData')
|
raise Exception('Error trying to OBS_GetData')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use(len(geomvals))
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetData(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -688,7 +688,7 @@ RETURNS TABLE (
|
|||||||
raise Exception('Error trying to OBS_GetData')
|
raise Exception('Error trying to OBS_GetData')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use(len(geomrefs))
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetMeta(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -736,7 +736,7 @@ RETURNS JSON AS $$
|
|||||||
import sys
|
import sys
|
||||||
logger.error('Error trying to OBS_GetMeta', sys.exc_info(), data={"username": username, "orgname": orgname})
|
logger.error('Error trying to OBS_GetMeta', sys.exc_info(), data={"username": username, "orgname": orgname})
|
||||||
raise Exception('Error trying to OBS_GetMeta')
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_MetadataValidation(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -782,4 +782,4 @@ RETURNS TABLE(valid boolean, errors text[]) AS $$
|
|||||||
import sys
|
import sys
|
||||||
logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname})
|
logger.error('Error trying to OBS_MetadataValidation', sys.exc_info(), data={"username": username, "orgname": orgname})
|
||||||
raise Exception('Error trying to OBS_MetadataValidation')
|
raise Exception('Error trying to OBS_MetadataValidation')
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -55,7 +55,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text)
|
|||||||
raise Exception('Error trying to OBS_Search')
|
raise Exception('Error trying to OBS_Search')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetAvailableBoundaries(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -113,4 +113,4 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text
|
|||||||
raise Exception('Error trying to OBS_GetMeasureById')
|
raise Exception('Error trying to OBS_GetMeasureById')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -49,7 +49,7 @@ RETURNS geometry(Geometry, 4326) AS $$
|
|||||||
raise Exception('Error trying to OBS_GetBoundary')
|
raise Exception('Error trying to OBS_GetBoundary')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryId(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -102,7 +102,7 @@ RETURNS TEXT AS $$
|
|||||||
raise Exception('Error trying to OBS_GetBoundaryId')
|
raise Exception('Error trying to OBS_GetBoundaryId')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundaryById(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -155,7 +155,7 @@ RETURNS geometry(Geometry, 4326) AS $$
|
|||||||
raise Exception('Error trying to OBS_GetBoundaryById')
|
raise Exception('Error trying to OBS_GetBoundaryById')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByGeometry(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -215,7 +215,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
raise Exception('Error trying to OBS_GetBoundariesByGeometry')
|
raise Exception('Error trying to OBS_GetBoundariesByGeometry')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -277,7 +277,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius')
|
raise Exception('Error trying to OBS_GetBoundariesByPointAndRadius')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByGeometry(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -337,7 +337,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
raise Exception('Error trying to OBS_GetPointsByGeometry')
|
raise Exception('Error trying to OBS_GetPointsByGeometry')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetPointsByPointAndRadius(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -399,4 +399,4 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
raise Exception('Error trying to OBS_GetPointsByPointAndRadius')
|
raise Exception('Error trying to OBS_GetPointsByPointAndRadius')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -8,7 +8,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)"
|
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))
|
.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]
|
)[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)
|
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 $$
|
RETURNS cdb_dataservices_server.ds_fdw_metadata AS $$
|
||||||
|
@ -8,7 +8,7 @@ RETURNS boolean AS $$
|
|||||||
logger_config = LoggerConfig(plpy)
|
logger_config = LoggerConfig(plpy)
|
||||||
GD[cache_key] = logger_config
|
GD[cache_key] = logger_config
|
||||||
return True
|
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
|
-- 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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_conf_getconf(input_key text)
|
||||||
@ -46,7 +46,7 @@ RETURNS boolean AS $$
|
|||||||
geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider)
|
geocoder_config = GeocoderConfig(redis_conn, plpy, username, orgname, provider)
|
||||||
GD[cache_key] = geocoder_config
|
GD[cache_key] = geocoder_config
|
||||||
return True
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_internal_geocoder_config(username text, orgname text)
|
||||||
RETURNS boolean AS $$
|
RETURNS boolean AS $$
|
||||||
@ -60,7 +60,7 @@ RETURNS boolean AS $$
|
|||||||
geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname)
|
geocoder_config = InternalGeocoderConfig(redis_conn, plpy, username, orgname)
|
||||||
GD[cache_key] = geocoder_config
|
GD[cache_key] = geocoder_config
|
||||||
return True
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_isolines_routing_config(username text, orgname text)
|
||||||
RETURNS boolean AS $$
|
RETURNS boolean AS $$
|
||||||
@ -74,7 +74,7 @@ RETURNS boolean AS $$
|
|||||||
isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname)
|
isolines_routing_config = IsolinesRoutingConfig(redis_conn, plpy, username, orgname)
|
||||||
GD[cache_key] = isolines_routing_config
|
GD[cache_key] = isolines_routing_config
|
||||||
return True
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_routing_config(username text, orgname text)
|
||||||
RETURNS boolean AS $$
|
RETURNS boolean AS $$
|
||||||
@ -88,7 +88,7 @@ RETURNS boolean AS $$
|
|||||||
routing_config = RoutingConfig(redis_conn, plpy, username, orgname)
|
routing_config = RoutingConfig(redis_conn, plpy, username, orgname)
|
||||||
GD[cache_key] = routing_config
|
GD[cache_key] = routing_config
|
||||||
return True
|
return True
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER;
|
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._get_obs_config(username text, orgname text)
|
||||||
RETURNS boolean AS $$
|
RETURNS boolean AS $$
|
||||||
@ -102,4 +102,4 @@ RETURNS boolean AS $$
|
|||||||
obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname)
|
obs_config = ObservatoryConfig(redis_conn, plpy, username, orgname)
|
||||||
GD[cache_key] = obs_config
|
GD[cache_key] = obs_config
|
||||||
return True
|
return True
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -106,7 +106,7 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$
|
|||||||
ret += [[service, monthly_quota, used_quota, soft_limit, provider]]
|
ret += [[service, monthly_quota, used_quota, soft_limit, provider]]
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info_batch(
|
||||||
@ -136,7 +136,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']]]
|
ret += [[info['service'], info['monthly_quota'], info['used_quota'], info['soft_limit'], info['provider'], info['max_batch_size']]]
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
|
@ -36,7 +36,7 @@ RETURNS Geometry AS $$
|
|||||||
else:
|
else:
|
||||||
raise Exception('Requested geocoder is not available')
|
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)
|
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)
|
||||||
@ -52,7 +52,7 @@ RETURNS Geometry AS $$
|
|||||||
else:
|
else:
|
||||||
raise Exception('Here geocoder is not available for your account.')
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -67,7 +67,7 @@ RETURNS Geometry AS $$
|
|||||||
else:
|
else:
|
||||||
raise Exception('Google geocoder is not available for your account.')
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -80,7 +80,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"])
|
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']
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -93,7 +93,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"])
|
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']
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -106,7 +106,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"])
|
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']
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -119,7 +119,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"])
|
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']
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -152,7 +152,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode street point using here maps')
|
raise Exception('Error trying to geocode street point using here maps')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -184,7 +184,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode street point using google maps')
|
raise Exception('Error trying to geocode street point using google maps')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -225,7 +225,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode street point using mapzen')
|
raise Exception('Error trying to geocode street point using mapzen')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -271,7 +271,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode street point using Mapbox')
|
raise Exception('Error trying to geocode street point using Mapbox')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -317,7 +317,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode street point using TomTom')
|
raise Exception('Error trying to geocode street point using TomTom')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -363,4 +363,4 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode street point using Geocodio')
|
raise Exception('Error trying to geocode street point using Geocodio')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
service_manager.quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -16,7 +16,7 @@ RETURNS JSON AS $$
|
|||||||
return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period})
|
return json.dumps({'limit': rate_limit_config.limit, 'period': rate_limit_config.period})
|
||||||
else:
|
else:
|
||||||
return None
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_user_rate_limit(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -40,7 +40,7 @@ RETURNS VOID AS $$
|
|||||||
period = None
|
period = None
|
||||||
config = RateLimitsConfig(service=service, username=username, limit=limit, period=period)
|
config = RateLimitsConfig(service=service, username=username, limit=limit, period=period)
|
||||||
config_setter.set_user_rate_limits(config)
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_org_rate_limit(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -64,7 +64,7 @@ RETURNS VOID AS $$
|
|||||||
period = None
|
period = None
|
||||||
config = RateLimitsConfig(service=service, username=username, limit=limit, period=period)
|
config = RateLimitsConfig(service=service, username=username, limit=limit, period=period)
|
||||||
config_setter.set_org_rate_limits(config)
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_set_server_rate_limit(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -88,4 +88,4 @@ RETURNS VOID AS $$
|
|||||||
period = None
|
period = None
|
||||||
config = RateLimitsConfig(service=service, username=username, limit=limit, period=period)
|
config = RateLimitsConfig(service=service, username=username, limit=limit, period=period)
|
||||||
config_setter.set_server_rate_limits(config)
|
config_setter.set_server_rate_limits(config)
|
||||||
$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE;
|
$$ LANGUAGE @@plpythonu@@ VOLATILE PARALLEL UNSAFE;
|
||||||
|
@ -40,7 +40,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"])
|
plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.{}($1, $2, $3); ".format(provider_function), ["text", "text", "jsonb"])
|
||||||
return plpy.execute(plan, [username, orgname, searches])
|
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)
|
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 $$
|
RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
||||||
@ -51,7 +51,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
|||||||
service_manager = LegacyServiceManager('geocoder', username, orgname, GD)
|
service_manager = LegacyServiceManager('geocoder', username, orgname, GD)
|
||||||
geocoder = GoogleMapsBulkGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger)
|
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)
|
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)
|
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 $$
|
RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
||||||
@ -62,7 +62,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
|||||||
service_manager = LegacyServiceManager('geocoder', username, orgname, GD)
|
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)
|
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)
|
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)
|
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 $$
|
RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
||||||
@ -79,7 +79,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
|||||||
service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD)
|
service_manager = ServiceManager('geocoder', TomTomGeocoderConfigBuilder, username, orgname, GD)
|
||||||
geocoder = TomTomBulkGeocoder(service_manager.config.tomtom_api_key, service_manager.logger, service_manager.config.service_params)
|
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)
|
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)
|
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 $$
|
RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
||||||
@ -96,7 +96,7 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
|||||||
service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD)
|
service_manager = ServiceManager('geocoder', MapboxGeocoderConfigBuilder, username, orgname, GD)
|
||||||
geocoder = MapboxBulkGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params)
|
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)
|
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)
|
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 $$
|
RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
||||||
@ -113,4 +113,4 @@ RETURNS SETOF cdb_dataservices_server.geocoding AS $$
|
|||||||
service_manager = ServiceManager('geocoder', GeocodioGeocoderConfigBuilder, username, orgname, GD)
|
service_manager = ServiceManager('geocoder', GeocodioGeocoderConfigBuilder, username, orgname, GD)
|
||||||
geocoder = GeocodioBulkGeocoder(service_manager.config.geocodio_api_key, service_manager.logger, service_manager.config.service_params)
|
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)
|
return run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, orgname, searches)
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -35,7 +35,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode admin0 polygon')
|
raise Exception('Error trying to geocode admin0 polygon')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -36,7 +36,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode admin1 polygon')
|
raise Exception('Error trying to geocode admin1 polygon')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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)
|
---- 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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text)
|
||||||
@ -74,7 +74,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode admin1 polygon')
|
raise Exception('Error trying to geocode admin1 polygon')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -16,7 +16,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})
|
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"])
|
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']
|
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)
|
---- 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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text)
|
||||||
@ -36,7 +36,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})
|
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"])
|
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']
|
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)
|
---- 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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text)
|
||||||
@ -56,7 +56,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})
|
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"])
|
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']
|
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)
|
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 $$
|
RETURNS Geometry AS $$
|
||||||
@ -101,7 +101,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode namedplace point')
|
raise Exception('Error trying to geocode namedplace point')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode postal code point')
|
raise Exception('Error trying to geocode postal code point')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision)
|
||||||
RETURNS Geometry AS $$
|
RETURNS Geometry AS $$
|
||||||
@ -77,7 +77,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode postal code point')
|
raise Exception('Error trying to geocode postal code point')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text)
|
||||||
RETURNS Geometry AS $$
|
RETURNS Geometry AS $$
|
||||||
@ -119,7 +119,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode postal code polygon')
|
raise Exception('Error trying to geocode postal code polygon')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision)
|
||||||
RETURNS Geometry AS $$
|
RETURNS Geometry AS $$
|
||||||
@ -162,7 +162,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode postal code polygon')
|
raise Exception('Error trying to geocode postal code polygon')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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)
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text)
|
||||||
RETURNS Geometry AS $$
|
RETURNS Geometry AS $$
|
||||||
|
@ -35,7 +35,7 @@ RETURNS Geometry AS $$
|
|||||||
raise Exception('Error trying to geocode postal code polygon')
|
raise Exception('Error trying to geocode postal code polygon')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get mapzen isolines')
|
raise Exception('Error trying to get mapzen isolines')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isodistance(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -121,7 +121,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get mapzen isolines')
|
raise Exception('Error trying to get mapzen isolines')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isodistance(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -185,7 +185,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get Mapbox isolines')
|
raise Exception('Error trying to get Mapbox isolines')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isodistance(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -249,7 +249,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get TomTom isolines')
|
raise Exception('Error trying to get TomTom isolines')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapzen_isochrones(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -310,7 +310,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get mapzen isochrones')
|
raise Exception('Error trying to get mapzen isochrones')
|
||||||
finally:
|
finally:
|
||||||
quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_mapbox_isochrones(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -368,7 +368,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get Mapbox isochrones')
|
raise Exception('Error trying to get Mapbox isochrones')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
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(
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server._cdb_tomtom_isochrones(
|
||||||
username TEXT,
|
username TEXT,
|
||||||
@ -426,4 +426,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
raise Exception('Error trying to get TomTom isochrones')
|
raise Exception('Error trying to get TomTom isochrones')
|
||||||
finally:
|
finally:
|
||||||
service_manager.quota_service.increment_total_service_use()
|
service_manager.quota_service.increment_total_service_use()
|
||||||
$$ LANGUAGE plpythonu SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -31,7 +31,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
||||||
else:
|
else:
|
||||||
raise Exception('Requested isolines provider is not available')
|
raise Exception('Requested isolines provider is not available')
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- heremaps isodistance
|
-- 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[])
|
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[])
|
||||||
@ -46,7 +46,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options])
|
result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- mapzen isodistance
|
-- 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[])
|
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[])
|
||||||
@ -60,7 +60,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options])
|
result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- mapbox isodistance
|
-- 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[])
|
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[])
|
||||||
@ -74,7 +74,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options])
|
result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- tomtom isodistance
|
-- 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[])
|
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[])
|
||||||
@ -88,4 +88,4 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -31,7 +31,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
return plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
||||||
else:
|
else:
|
||||||
raise Exception('Requested isolines provider is not available')
|
raise Exception('Requested isolines provider is not available')
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- heremaps isochrone
|
-- 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[])
|
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[])
|
||||||
@ -46,7 +46,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
|||||||
result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options])
|
result = plpy.execute(here_plan, [username, orgname, type, source, mode, range, options])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- mapzen isochrone
|
-- 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[])
|
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[])
|
||||||
@ -59,7 +59,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[]"])
|
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])
|
result = plpy.execute(mapzen_plan, [username, orgname, source, mode, range, options])
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- mapbox isochrone
|
-- 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[])
|
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[])
|
||||||
@ -72,7 +72,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[]"])
|
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])
|
result = plpy.execute(mapbox_plan, [username, orgname, source, mode, range, options])
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
|
||||||
-- tomtom isochrone
|
-- 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[])
|
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[])
|
||||||
@ -85,4 +85,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[]"])
|
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])
|
result = plpy.execute(tomtom_plan, [username, orgname, source, mode, range, options])
|
||||||
return result
|
return result
|
||||||
$$ LANGUAGE plpythonu STABLE PARALLEL RESTRICTED;
|
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
-- Install dependencies
|
-- Install dependencies
|
||||||
CREATE EXTENSION postgis;
|
CREATE EXTENSION postgis;
|
||||||
CREATE EXTENSION plpythonu;
|
CREATE EXTENSION @@plpythonu@@;
|
||||||
CREATE EXTENSION plproxy;
|
CREATE EXTENSION plproxy;
|
||||||
CREATE EXTENSION cartodb;
|
CREATE EXTENSION cartodb;
|
||||||
CREATE EXTENSION cdb_geocoder;
|
CREATE EXTENSION cdb_geocoder;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
-- Install dependencies
|
-- Install dependencies
|
||||||
CREATE EXTENSION postgis;
|
CREATE EXTENSION postgis;
|
||||||
CREATE EXTENSION plpythonu;
|
CREATE EXTENSION @@plpythonu@@;
|
||||||
CREATE EXTENSION plproxy;
|
CREATE EXTENSION plproxy;
|
||||||
CREATE EXTENSION cartodb;
|
CREATE EXTENSION cartodb;
|
||||||
CREATE EXTENSION cdb_geocoder;
|
CREATE EXTENSION cdb_geocoder;
|
||||||
|
@ -14,7 +14,7 @@ DO $$
|
|||||||
service_config.user.set('soft_obs_general_limit', True)
|
service_config.user.set('soft_obs_general_limit', True)
|
||||||
service_config.user.set('period_end_date', '20170516')
|
service_config.user.set('period_end_date', '20170516')
|
||||||
|
|
||||||
$$ LANGUAGE plpythonu;
|
$$ LANGUAGE @@plpythonu@@;
|
||||||
|
|
||||||
|
|
||||||
-- Mock Observatory backend function
|
-- Mock Observatory backend function
|
||||||
|
Loading…
Reference in New Issue
Block a user