Merge pull request #592 from CartoDB/development
Deploy client `0.29.0` and server `0.38.0` to prod
This commit is contained in:
commit
1a2d8e865c
8
NEWS.md
8
NEWS.md
@ -1,3 +1,11 @@
|
||||
Mar 17th, 2020
|
||||
==============
|
||||
* Version `0.29.0` of the client extension
|
||||
* Adapted client to PG12 (https://github.com/CartoDB/cartodb-platform/issues/6237)
|
||||
* Version `0.38.0` of the server extension
|
||||
* Adapted server to PG12 (https://github.com/CartoDB/cartodb-platform/issues/6237)
|
||||
* Update dependencies to fix vulnerabilities
|
||||
|
||||
Mar 6th, 2020
|
||||
==============
|
||||
* Version `0.23.1` of the Python library
|
||||
|
@ -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,7 +95,8 @@ release: $(EXTENSION).control $(SOURCES_DATA)
|
||||
devclean:
|
||||
rm -f $(NEW_EXTENSION_ARTIFACT)
|
||||
rm -f $(GENERATED_SQL_FILES)
|
||||
rm -rf $(TEST_DIR)
|
||||
|
||||
clean: restore_copies
|
||||
|
||||
# If needed remove PARALLEL tags from the release files
|
||||
release_remove_parallel_deploy:
|
||||
@ -107,21 +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
|
||||
# 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
|
||||
|
@ -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": {
|
||||
}
|
||||
|
19
client/cdb_dataservices_client--0.28.0--0.29.0.sql
Normal file
19
client/cdb_dataservices_client--0.28.0--0.29.0.sql
Normal file
@ -0,0 +1,19 @@
|
||||
--DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES
|
||||
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||
\echo Use "ALTER EXTENSION cdb_dataservices_client UPDATE TO '0.29.0'" to load this file. \quit
|
||||
|
||||
-- Make sure we have a sane search path to create/update the extension
|
||||
SET search_path = "$user",cartodb,public,cdb_dataservices_client;
|
||||
|
||||
-- HERE goes your code to upgrade/downgrade
|
||||
-- PG12_DEPRECATED
|
||||
-- Create geomval if it doesn't exist (in postgis 3+ it only exists in postgis_raster)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'geomval') THEN
|
||||
CREATE TYPE cdb_dataservices_client.geomval AS (
|
||||
geom geometry,
|
||||
val double precision
|
||||
);
|
||||
END IF;
|
||||
END$$;
|
14
client/cdb_dataservices_client--0.29.0--0.28.0.sql
Normal file
14
client/cdb_dataservices_client--0.29.0--0.28.0.sql
Normal file
@ -0,0 +1,14 @@
|
||||
--DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES
|
||||
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||
\echo Use "ALTER EXTENSION cdb_dataservices_client UPDATE TO '0.28.0'" to load this file. \quit
|
||||
|
||||
-- Make sure we have a sane search path to create/update the extension
|
||||
SET search_path = "$user",cartodb,public,cdb_dataservices_client;
|
||||
|
||||
-- HERE goes your code to upgrade/downgrade
|
||||
-- PG12_DEPRECATED
|
||||
-- Create geomval if it doesn't exist (in postgis 3+ it only exists in postgis_raster)
|
||||
DO $$
|
||||
BEGIN
|
||||
DROP TYPE IF EXISTS cdb_dataservices_client.geomval RESTRICT;
|
||||
END$$;
|
5836
client/cdb_dataservices_client--0.29.0.sql
Normal file
5836
client/cdb_dataservices_client--0.29.0.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
# Makefile to generate the extension out of separate sql source files.
|
||||
# Once a version is released, it is not meant to be changed. E.g: once version 0.0.1 is out, it SHALL NOT be changed.
|
||||
EXTENSION = cdb_dataservices_server
|
||||
EXTVERSION = $(shell grep default_version $(EXTENSION).control.in | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
|
||||
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
|
||||
# The new version to be generated from templates
|
||||
SED = sed
|
||||
ERB = erb
|
||||
@ -14,7 +14,7 @@ PG_PARALLEL := $(shell $(PG_CONFIG) --version | ($(AWK) '{$$2*=1000; if ($$
|
||||
|
||||
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
|
||||
@ -27,7 +27,6 @@ DATA = $(NEW_EXTENSION_ARTIFACT) \
|
||||
$(OLD_VERSIONS)
|
||||
SOURCES_DATA_DIR = sql/
|
||||
SOURCES_DATA = $(wildcard sql/*.sql)
|
||||
SOURCES_DATA_DIR_OUT = sql_out/
|
||||
|
||||
# postgres build stuff
|
||||
PG_CONFIG = pg_config
|
||||
@ -49,7 +48,7 @@ endif
|
||||
|
||||
$(NEW_EXTENSION_ARTIFACT): $(SOURCES_DATA)
|
||||
rm -f $@
|
||||
cat $(SOURCES_DATA_DIR_OUT)/*.sql >> $@
|
||||
cat $(SOURCES_DATA_DIR)/*.sql >> $@
|
||||
ifeq ($(PG_PARALLEL), 0)
|
||||
# Remove PARALLEL in aggregates and functions
|
||||
$(eval TMPFILE := $(shell mktemp /tmp/$(basename $0).XXXXXXXX))
|
||||
@ -58,34 +57,35 @@ ifeq ($(PG_PARALLEL), 0)
|
||||
mv $(TMPFILE) $@
|
||||
endif
|
||||
|
||||
$(EXTENSION).control: $(EXTENSION).control.in Makefile
|
||||
$(SED) $(REPLACEMENTS) $< > $@
|
||||
# $(EXTENSION).control: $(EXTENSION).control.in Makefile
|
||||
# $(SED) $(REPLACEMENTS) $< > $@
|
||||
|
||||
.PHONY: all
|
||||
all: replace_variables $(DATA)
|
||||
all: $(DATA)
|
||||
|
||||
.PHONY: release
|
||||
release: replace_variables $(EXTENSION).control $(SOURCES_DATA)
|
||||
release: $(EXTENSION).control $(SOURCES_DATA)
|
||||
test -n "$(NEW_VERSION)" # $$NEW_VERSION VARIABLE MISSING. Eg. make release NEW_VERSION=0.x.0
|
||||
git mv *.sql old_versions
|
||||
$(SED) $(REPLACEMENTS) $(EXTENSION).control.in > $(EXTENSION).control
|
||||
for f in $(wildcard *.sql); do \
|
||||
git mv $${f} old_versions/$${f}; \
|
||||
done
|
||||
$(SED) -i 's/$(EXTVERSION)/$(NEW_VERSION)/g' $(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
|
||||
@echo
|
||||
@echo "Please review the file $(EXTENSION)--$(EXTVERSION)--$(NEW_VERSION).sql and add any code needed to upgrade $(EXTVERSION) to $(NEW_VERSION)"
|
||||
@echo "Please review the file $(EXTENSION)--$(NEW_VERSION)--$(EXTVERSION).sql and add any code needed to downgrade $(NEW_VERSION) to $(EXTVERSION)"
|
||||
@echo "Please review the file $(EXTENSION)--$(EXTVERSION)--$(NEW_VERSION).sql.in and add any code needed to upgrade $(EXTVERSION) to $(NEW_VERSION)"
|
||||
@echo "Please review the file $(EXTENSION)--$(NEW_VERSION)--$(EXTVERSION).sql.in and add any code needed to downgrade $(NEW_VERSION) to $(EXTVERSION)"
|
||||
@echo
|
||||
|
||||
# Only meant for development time, do not use once a version is released
|
||||
.PHONY: devclean
|
||||
devclean:
|
||||
rm -f $(NEW_EXTENSION_ARTIFACT)
|
||||
rm -rf $(TEST_DIR)
|
||||
rm -rf $(SOURCES_DATA_DIR_OUT)
|
||||
rm -rf $(EXTENSION).control
|
||||
|
||||
clean: restore_copies
|
||||
|
||||
# If needed remove PARALLEL tags from the release files
|
||||
release_remove_parallel_deploy:
|
||||
@ -102,31 +102,60 @@ deploy: release_remove_parallel_deploy
|
||||
$(INSTALL_DATA) $(EXTENSION).control '$(DESTDIR)$(datadir)/extension/'
|
||||
$(INSTALL_DATA) old_versions/*.sql *.sql '$(DESTDIR)$(datadir)/extension/'
|
||||
|
||||
# Replacing variables defined within test files
|
||||
replace_variables:
|
||||
restore_copies:
|
||||
# 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; \
|
||||
for f in $(basename $(wildcard test/sql/*.copy)); do \
|
||||
cat $${f}.copy > $${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 $(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;
|
||||
|
||||
|
||||
# %.sql:
|
||||
# $(SED) $(REPLACEMENTS) $< > $@
|
||||
|
||||
# Replacing variables defined within test files
|
||||
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 $(sort $(wildcard test/expected/*test.out)); do \
|
||||
sed --in-place=.copy -e 's/@@plpythonu@@/$(PLPYTHONU)/g' $${f}; \
|
||||
done
|
||||
# data
|
||||
mkdir -p $(SOURCES_DATA_DIR_OUT)
|
||||
for f in $(notdir $(SOURCES_DATA)); do \
|
||||
cat $(SOURCES_DATA_DIR)/$${f} | \
|
||||
sed -e 's/@@plpythonu@@/$(PLPYTHONU)/g' \
|
||||
> $(SOURCES_DATA_DIR_OUT)/$${f}; \
|
||||
for f in $(SOURCES_DATA); 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: deploy
|
||||
install: replace_variables deploy
|
||||
|
||||
reinstall: install
|
||||
psql -U postgres -d dataservices_db -c "drop extension if exists cdb_dataservices_server; create extension cdb_dataservices_server;"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"requires": {
|
||||
"postgresql": "^10.0.0",
|
||||
"postgis": "^2.4.0.0",
|
||||
"carto_postgresql_ext": "^0.23.0"
|
||||
"carto_postgresql_ext": "^0.36.0"
|
||||
},
|
||||
"works_with": {
|
||||
"dataservices-api-server-python-lib": "^0.19.1",
|
||||
"dataservices-api-server-python-lib": "^0.23.1",
|
||||
"observatory-server-extension": "^1.9.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
76
server/extension/cdb_dataservices_server--0.37.0--0.38.0.sql
Normal file
76
server/extension/cdb_dataservices_server--0.37.0--0.38.0.sql
Normal file
@ -0,0 +1,76 @@
|
||||
--DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES
|
||||
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||
\echo Use "ALTER EXTENSION cdb_dataservices_server UPDATE TO '0.38.0'" to load this file. \quit
|
||||
|
||||
-- HERE goes your code to upgrade/downgrade
|
||||
-- PG12_DEPRECATED
|
||||
-- Create geomval if it doesn't exist (in postgis 3+ it only exists in postgis_raster)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'geomval') THEN
|
||||
CREATE TYPE cdb_dataservices_server.geomval AS (
|
||||
geom geometry,
|
||||
val double precision
|
||||
);
|
||||
END IF;
|
||||
END$$;
|
||||
|
||||
---- 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)
|
||||
RETURNS Geometry AS $$
|
||||
from plpy import spiexceptions
|
||||
from cartodb_services.tools import Logger,LoggerConfig
|
||||
|
||||
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||
logger_config = GD["logger_config"]
|
||||
logger = Logger(logger_config)
|
||||
|
||||
try:
|
||||
street_point = plpy.prepare("SELECT cdb_dataservices_server.cdb_geocode_street_point($1, $2, $3) as point;", ["text", "text", "text"])
|
||||
return plpy.execute(street_point, [username, orgname, city_name])[0]['point']
|
||||
except spiexceptions.ExternalRoutineException as e:
|
||||
import sys
|
||||
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;
|
||||
|
||||
---- 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)
|
||||
RETURNS Geometry AS $$
|
||||
from plpy import spiexceptions
|
||||
from cartodb_services.tools import Logger,LoggerConfig
|
||||
|
||||
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||
logger_config = GD["logger_config"]
|
||||
logger = Logger(logger_config)
|
||||
|
||||
try:
|
||||
street_point = plpy.prepare("SELECT cdb_dataservices_server.cdb_geocode_street_point($1, $2, $3, NULL, NULL, $4) as point;", ["text", "text", "text", "text"])
|
||||
return plpy.execute(street_point, [username, orgname, city_name, country_name])[0]['point']
|
||||
except spiexceptions.ExternalRoutineException as e:
|
||||
import sys
|
||||
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;
|
||||
|
||||
---- 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)
|
||||
RETURNS Geometry AS $$
|
||||
from plpy import spiexceptions
|
||||
from cartodb_services.tools import Logger,LoggerConfig
|
||||
|
||||
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||
logger_config = GD["logger_config"]
|
||||
logger = Logger(logger_config)
|
||||
|
||||
try:
|
||||
street_point = plpy.prepare("SELECT cdb_dataservices_server.cdb_geocode_street_point($1, $2, $3, NULL, $4, $5) as point;", ["text", "text", "text", "text", "text"])
|
||||
return plpy.execute(street_point, [username, orgname, city_name, admin1_name, country_name])[0]['point']
|
||||
except spiexceptions.ExternalRoutineException as e:
|
||||
import sys
|
||||
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;
|
71
server/extension/cdb_dataservices_server--0.38.0--0.37.0.sql
Normal file
71
server/extension/cdb_dataservices_server--0.38.0--0.37.0.sql
Normal file
@ -0,0 +1,71 @@
|
||||
--DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES
|
||||
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||
\echo Use "ALTER EXTENSION cdb_dataservices_server UPDATE TO '0.37.0'" to load this file. \quit
|
||||
|
||||
-- HERE goes your code to upgrade/downgrade
|
||||
-- PG12_DEPRECATED
|
||||
-- Create geomval if it doesn't exist (in postgis 3+ it only exists in postgis_raster)
|
||||
DO $$
|
||||
BEGIN
|
||||
DROP TYPE IF EXISTS cdb_dataservices_server.geomval RESTRICT;
|
||||
END$$;
|
||||
|
||||
---- 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)
|
||||
RETURNS Geometry AS $$
|
||||
import spiexceptions
|
||||
from cartodb_services.tools import Logger,LoggerConfig
|
||||
|
||||
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||
logger_config = GD["logger_config"]
|
||||
logger = Logger(logger_config)
|
||||
|
||||
try:
|
||||
street_point = plpy.prepare("SELECT cdb_dataservices_server.cdb_geocode_street_point($1, $2, $3) as point;", ["text", "text", "text"])
|
||||
return plpy.execute(street_point, [username, orgname, city_name])[0]['point']
|
||||
except spiexceptions.ExternalRoutineException as e:
|
||||
import sys
|
||||
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;
|
||||
|
||||
---- 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)
|
||||
RETURNS Geometry AS $$
|
||||
import spiexceptions
|
||||
from cartodb_services.tools import Logger,LoggerConfig
|
||||
|
||||
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||
logger_config = GD["logger_config"]
|
||||
logger = Logger(logger_config)
|
||||
|
||||
try:
|
||||
street_point = plpy.prepare("SELECT cdb_dataservices_server.cdb_geocode_street_point($1, $2, $3, NULL, NULL, $4) as point;", ["text", "text", "text", "text"])
|
||||
return plpy.execute(street_point, [username, orgname, city_name, country_name])[0]['point']
|
||||
except spiexceptions.ExternalRoutineException as e:
|
||||
import sys
|
||||
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;
|
||||
|
||||
---- 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)
|
||||
RETURNS Geometry AS $$
|
||||
import spiexceptions
|
||||
from cartodb_services.tools import Logger,LoggerConfig
|
||||
|
||||
plpy.execute("SELECT cdb_dataservices_server._get_logger_config()")
|
||||
logger_config = GD["logger_config"]
|
||||
logger = Logger(logger_config)
|
||||
|
||||
try:
|
||||
street_point = plpy.prepare("SELECT cdb_dataservices_server.cdb_geocode_street_point($1, $2, $3, NULL, $4, $5) as point;", ["text", "text", "text", "text", "text"])
|
||||
return plpy.execute(street_point, [username, orgname, city_name, admin1_name, country_name])[0]['point']
|
||||
except spiexceptions.ExternalRoutineException as e:
|
||||
import sys
|
||||
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;
|
3896
server/extension/cdb_dataservices_server--0.38.0.sql
Normal file
3896
server/extension/cdb_dataservices_server--0.38.0.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ python-dateutil==2.2
|
||||
googlemaps==2.5.1
|
||||
rollbar==0.13.2
|
||||
# Dependency for googlemaps package
|
||||
requests==2.9.1
|
||||
requests==2.20.0
|
||||
rratelimit==0.0.4
|
||||
mapbox==0.14.0
|
||||
pygeocodio==0.11.1
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Integration tests dependencies
|
||||
requests==2.9.1
|
||||
requests==2.20.0
|
||||
nose==1.3.7
|
||||
|
Loading…
Reference in New Issue
Block a user