Compare commits
32 Commits
python-0.1
...
0.12.1-cli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f2883be5d | ||
|
|
5d94a852e4 | ||
|
|
f0474852f2 | ||
|
|
975efb0f92 | ||
|
|
7f963d2f7a | ||
|
|
8396eae733 | ||
|
|
25cd40164a | ||
|
|
dfaa037475 | ||
|
|
c92ab9c207 | ||
|
|
27806ead54 | ||
|
|
d1b17da70b | ||
|
|
b5f4c507b3 | ||
|
|
d65a0d9ac5 | ||
|
|
08debb83ed | ||
|
|
dac5e76e98 | ||
|
|
4945b4d0bf | ||
|
|
e6963198dc | ||
|
|
9ae04aaad2 | ||
|
|
b392eaf74b | ||
|
|
040b094b01 | ||
|
|
a006f76285 | ||
|
|
38f2592b22 | ||
|
|
94099540d7 | ||
|
|
b403e1d69a | ||
|
|
623faf1a22 | ||
|
|
7d9dc554c5 | ||
|
|
fffb64de36 | ||
|
|
6b56c4ad0d | ||
|
|
1f8fb28449 | ||
|
|
7fd13f416d | ||
|
|
f41a30316e | ||
|
|
5499bd1e69 |
19
NEWS.md
19
NEWS.md
@@ -1,3 +1,22 @@
|
|||||||
|
November 7st, 2016
|
||||||
|
==================
|
||||||
|
* Version 0.17.0 of the server and version 0.10.0 of the python package
|
||||||
|
* Added metrics context manager to gather data from different parts of the server functions
|
||||||
|
* Support multiple response data for one server function call: For example in the one_to_many matrix client
|
||||||
|
* Metrics files configuration is not mandatory
|
||||||
|
* All the services covered and gathering metrics
|
||||||
|
|
||||||
|
October 27st, 2016
|
||||||
|
==================
|
||||||
|
* Version 0.9.4 of the python package
|
||||||
|
* Added timeouts to all the third-party connections using requests because requests by default doesn't add timeouts.
|
||||||
|
|
||||||
|
October 26st, 2016
|
||||||
|
==================
|
||||||
|
* Version 0.9.3 of the python package
|
||||||
|
* Fixes https://github.com/CartoDB/dataservices-api/issues/293
|
||||||
|
* Mitigate problem with 504 errors coming from Mapzen
|
||||||
|
|
||||||
October 21st, 2016
|
October 21st, 2016
|
||||||
==================
|
==================
|
||||||
* Version 0.9.2 of the python package
|
* Version 0.9.2 of the python package
|
||||||
|
|||||||
@@ -4,29 +4,31 @@ EXTENSION = cdb_dataservices_client
|
|||||||
EXTVERSION = $(shell grep default_version $(EXTENSION).control | 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
|
# The new version to be generated from templates
|
||||||
|
SED = sed
|
||||||
|
ERB = erb
|
||||||
|
REPLACEMENTS = -i 's/$(EXTVERSION)/$(NEW_VERSION)/g'
|
||||||
NEW_EXTENSION_ARTIFACT = $(EXTENSION)--$(EXTVERSION).sql
|
NEW_EXTENSION_ARTIFACT = $(EXTENSION)--$(EXTVERSION).sql
|
||||||
|
|
||||||
|
# OLD_VERSIONS = $(wildcard old_versions/*.sql)
|
||||||
|
# DATA = $(NEW_EXTENSION_ARTIFACT) \
|
||||||
|
# $(OLD_VERSIONS) \
|
||||||
|
# cdb_dataservices_client--0.11.0--0.11.1.sql \
|
||||||
|
# cdb_dataservices_client--0.11.1--0.11.0.sql
|
||||||
OLD_VERSIONS = $(wildcard old_versions/*.sql)
|
OLD_VERSIONS = $(wildcard old_versions/*.sql)
|
||||||
|
DATA = $(NEW_EXTENSION_ARTIFACT) \
|
||||||
|
$(EXTENSION)--*--*.sql \
|
||||||
|
$(OLD_VERSIONS)
|
||||||
|
SOURCES_DATA_DIR = sql/
|
||||||
|
|
||||||
|
|
||||||
|
REGRESS = $(notdir $(basename $(wildcard test/sql/*test.sql)))
|
||||||
|
TEST_DIR = test/
|
||||||
|
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
|
||||||
# These are the files to be installed in the server shared dir,
|
# These are the files to be installed in the server shared dir,
|
||||||
# for installation from scratch, upgrades and downgrades.
|
# for installation from scratch, upgrades and downgrades.
|
||||||
# @see http://www.postgresql.org/docs/current/static/extend-pgxs.html
|
# @see http://www.postgresql.org/docs/current/static/extend-pgxs.html
|
||||||
DATA = $(NEW_EXTENSION_ARTIFACT) \
|
|
||||||
$(OLD_VERSIONS) \
|
|
||||||
cdb_dataservices_client--0.11.0--0.11.1.sql \
|
|
||||||
cdb_dataservices_client--0.11.1--0.11.0.sql
|
|
||||||
|
|
||||||
|
|
||||||
REGRESS = $(notdir $(basename $(wildcard test/sql/*test.sql)))
|
|
||||||
TEST_DIR = test/
|
|
||||||
REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)'
|
|
||||||
|
|
||||||
# postgres build stuff
|
|
||||||
PG_CONFIG = pg_config
|
|
||||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
|
||||||
include $(PGXS)
|
|
||||||
|
|
||||||
SOURCES_DATA_DIR = sql/
|
|
||||||
|
|
||||||
# The interface definition is used along with some templates to automatically generate code
|
# The interface definition is used along with some templates to automatically generate code
|
||||||
RENDERER = renderer/sql-template-renderer
|
RENDERER = renderer/sql-template-renderer
|
||||||
@@ -35,6 +37,11 @@ TEMPLATE_DIR = renderer/templates
|
|||||||
TEMPLATE_FILES = $(wildcard $(TEMPLATE_DIR)/*.erb)
|
TEMPLATE_FILES = $(wildcard $(TEMPLATE_DIR)/*.erb)
|
||||||
GENERATED_SQL_FILES = $(patsubst $(TEMPLATE_DIR)/%.erb, $(SOURCES_DATA_DIR)/%.sql, $(TEMPLATE_FILES))
|
GENERATED_SQL_FILES = $(patsubst $(TEMPLATE_DIR)/%.erb, $(SOURCES_DATA_DIR)/%.sql, $(TEMPLATE_FILES))
|
||||||
|
|
||||||
|
# postgres build stuff
|
||||||
|
PG_CONFIG = pg_config
|
||||||
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||||
|
include $(PGXS)
|
||||||
|
|
||||||
$(GENERATED_SQL_FILES): $(SOURCES_DATA_DIR)/%.sql: $(TEMPLATE_DIR)/%.erb $(INTERFACE_FILE) $(RENDERER)
|
$(GENERATED_SQL_FILES): $(SOURCES_DATA_DIR)/%.sql: $(TEMPLATE_DIR)/%.erb $(INTERFACE_FILE) $(RENDERER)
|
||||||
$(RENDERER) $(INTERFACE_FILE) $< > $@
|
$(RENDERER) $(INTERFACE_FILE) $< > $@
|
||||||
|
|
||||||
@@ -44,9 +51,20 @@ $(NEW_EXTENSION_ARTIFACT): $(SOURCES_DATA)
|
|||||||
rm -f $@
|
rm -f $@
|
||||||
cat $(SOURCES_DATA_DIR)/*.sql >> $@
|
cat $(SOURCES_DATA_DIR)/*.sql >> $@
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
all: $(DATA)
|
all: $(DATA)
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: $(EXTENSION).control $(SOURCES_DATA)
|
||||||
|
test -n "$(NEW_VERSION)" # $$NEW_VERSION VARIABLE MISSING. Eg. make release NEW_VERSION=0.x.0
|
||||||
|
mv *.sql old_versions
|
||||||
|
$(SED) $(REPLACEMENTS) $(EXTENSION).control
|
||||||
|
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
|
||||||
|
|
||||||
# Only meant for development time, do not use once a version is released
|
# Only meant for development time, do not use once a version is released
|
||||||
|
.PHONY: devclean
|
||||||
devclean:
|
devclean:
|
||||||
rm -f $(NEW_EXTENSION_ARTIFACT)
|
rm -f $(NEW_EXTENSION_ARTIFACT)
|
||||||
rm -f $(GENERATED_SQL_FILES)
|
rm -f $(GENERATED_SQL_FILES)
|
||||||
|
|||||||
12
client/cdb_dataservices_client--0.12.0--0.12.1.sql
Normal file
12
client/cdb_dataservices_client--0.12.0--0.12.1.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--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.12.1'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE score numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE numtiles bigint;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE notnull_percent numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE numgeoms numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE percentfill numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE estnumgeoms numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry ADD ATTRIBUTE meanmediansize numeric;
|
||||||
12
client/cdb_dataservices_client--0.12.1--0.12.0.sql
Normal file
12
client/cdb_dataservices_client--0.12.1--0.12.0.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--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.12.0'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE score;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE numtiles;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE notnull_percent;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE numgeoms;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE percentfill;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE estnumgeoms;
|
||||||
|
ALTER TYPE cdb_dataservices_client.obs_meta_geometry DROP ATTRIBUTE meanmediansize;
|
||||||
1987
client/cdb_dataservices_client--0.12.1.sql
Normal file
1987
client/cdb_dataservices_client--0.12.1.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
comment = 'CartoDB dataservices client API extension'
|
comment = 'CartoDB dataservices client API extension'
|
||||||
default_version = '0.11.1'
|
default_version = '0.12.1'
|
||||||
requires = 'plproxy, cartodb'
|
requires = 'plproxy, cartodb'
|
||||||
superuser = true
|
superuser = true
|
||||||
schema = cdb_dataservices_client
|
schema = cdb_dataservices_client
|
||||||
|
|||||||
172
client/old_versions/cdb_dataservices_client--0.11.1--0.12.0.sql
Normal file
172
client/old_versions/cdb_dataservices_client--0.11.1--0.12.0.sql
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
--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.12.0'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_numerator AS (numer_id text, numer_name text, numer_description text, numer_weight text, numer_license text, numer_source text, numer_type text, numer_aggregate text, numer_extra jsonb, numer_tags jsonb, valid_denom boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_denominator AS (denom_id text, denom_name text, denom_description text, denom_weight text, denom_license text, denom_source text, denom_type text, denom_aggregate text, denom_extra jsonb, denom_tags jsonb, valid_numer boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_getavailablenumerators (bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, denom_id text DEFAULT NULL, geom_id text DEFAULT NULL, timespan text DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_numerator AS $$
|
||||||
|
DECLARE
|
||||||
|
|
||||||
|
username text;
|
||||||
|
orgname text;
|
||||||
|
BEGIN
|
||||||
|
IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
||||||
|
RAISE EXCEPTION 'The api_key must be provided';
|
||||||
|
END IF;
|
||||||
|
SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text);
|
||||||
|
-- JSON value stored "" is taken as literal
|
||||||
|
IF username IS NULL OR username = '' OR username = '""' THEN
|
||||||
|
RAISE EXCEPTION 'Username is a mandatory argument, check it out';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN QUERY
|
||||||
|
SELECT * FROM cdb_dataservices_client._obs_getavailablenumerators(username, orgname, bounds, filter_tags, denom_id, geom_id, timespan);
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_getavailabledenominators (bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, numer_id text DEFAULT NULL, geom_id text DEFAULT NULL, timespan text DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_denominator AS $$
|
||||||
|
DECLARE
|
||||||
|
|
||||||
|
username text;
|
||||||
|
orgname text;
|
||||||
|
BEGIN
|
||||||
|
IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
||||||
|
RAISE EXCEPTION 'The api_key must be provided';
|
||||||
|
END IF;
|
||||||
|
SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text);
|
||||||
|
-- JSON value stored "" is taken as literal
|
||||||
|
IF username IS NULL OR username = '' OR username = '""' THEN
|
||||||
|
RAISE EXCEPTION 'Username is a mandatory argument, check it out';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN QUERY
|
||||||
|
SELECT * FROM cdb_dataservices_client._obs_getavailabledenominators(username, orgname, bounds, filter_tags, numer_id, geom_id, timespan);
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_getavailablegeometries (bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, numer_id text DEFAULT NULL, denom_id text DEFAULT NULL, timespan text DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_geometry AS $$
|
||||||
|
DECLARE
|
||||||
|
|
||||||
|
username text;
|
||||||
|
orgname text;
|
||||||
|
BEGIN
|
||||||
|
IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
||||||
|
RAISE EXCEPTION 'The api_key must be provided';
|
||||||
|
END IF;
|
||||||
|
SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text);
|
||||||
|
-- JSON value stored "" is taken as literal
|
||||||
|
IF username IS NULL OR username = '' OR username = '""' THEN
|
||||||
|
RAISE EXCEPTION 'Username is a mandatory argument, check it out';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN QUERY
|
||||||
|
SELECT * FROM cdb_dataservices_client._obs_getavailablegeometries(username, orgname, bounds, filter_tags, numer_id, denom_id, timespan);
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_getavailabletimespans (bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, numer_id text DEFAULT NULL, denom_id text DEFAULT NULL, geom_id text DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_timespan AS $$
|
||||||
|
DECLARE
|
||||||
|
|
||||||
|
username text;
|
||||||
|
orgname text;
|
||||||
|
BEGIN
|
||||||
|
IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
||||||
|
RAISE EXCEPTION 'The api_key must be provided';
|
||||||
|
END IF;
|
||||||
|
SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text);
|
||||||
|
-- JSON value stored "" is taken as literal
|
||||||
|
IF username IS NULL OR username = '' OR username = '""' THEN
|
||||||
|
RAISE EXCEPTION 'Username is a mandatory argument, check it out';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN QUERY
|
||||||
|
SELECT * FROM cdb_dataservices_client._obs_getavailabletimespans(username, orgname, bounds, filter_tags, numer_id, denom_id, geom_id);
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_legacybuildermetadata (aggregate_type text DEFAULT NULL)
|
||||||
|
RETURNS TABLE(name text, subsection json) AS $$
|
||||||
|
DECLARE
|
||||||
|
|
||||||
|
username text;
|
||||||
|
orgname text;
|
||||||
|
BEGIN
|
||||||
|
IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
||||||
|
RAISE EXCEPTION 'The api_key must be provided';
|
||||||
|
END IF;
|
||||||
|
SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text);
|
||||||
|
-- JSON value stored "" is taken as literal
|
||||||
|
IF username IS NULL OR username = '' OR username = '""' THEN
|
||||||
|
RAISE EXCEPTION 'Username is a mandatory argument, check it out';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN QUERY
|
||||||
|
SELECT * FROM cdb_dataservices_client._obs_legacybuildermetadata(username, orgname, aggregate_type);
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client._obs_getavailablenumerators (username text, organization_name text, bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, denom_id text DEFAULT NULL, geom_id text DEFAULT NULL, timespan text DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_numerator AS $$
|
||||||
|
CONNECT cdb_dataservices_client._server_conn_str();
|
||||||
|
|
||||||
|
SELECT * FROM cdb_dataservices_server.obs_getavailablenumerators (username, organization_name, bounds, filter_tags, denom_id, geom_id, timespan);
|
||||||
|
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client._obs_getavailabledenominators (username text, organization_name text, bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, numer_id text DEFAULT NULL, geom_id text DEFAULT NULL, timespan text DEFAULT NULL)
|
||||||
|
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_denominator AS $$
|
||||||
|
CONNECT cdb_dataservices_client._server_conn_str();
|
||||||
|
|
||||||
|
SELECT * FROM cdb_dataservices_server.obs_getavailabledenominators (username, organization_name, bounds, filter_tags, numer_id, geom_id, timespan);
|
||||||
|
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client._obs_getavailablegeometries (username text, organization_name text, bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, numer_id text DEFAULT NULL, denom_id text DEFAULT NULL, timespan text DEFAULT NULL)
|
||||||
|
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_geometry AS $$
|
||||||
|
CONNECT cdb_dataservices_client._server_conn_str();
|
||||||
|
|
||||||
|
SELECT * FROM cdb_dataservices_server.obs_getavailablegeometries (username, organization_name, bounds, filter_tags, numer_id, denom_id, timespan);
|
||||||
|
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client._obs_getavailabletimespans (username text, organization_name text, bounds geometry(Geometry, 4326) DEFAULT NULL, filter_tags text[] DEFAULT NULL, numer_id text DEFAULT NULL, denom_id text DEFAULT NULL, geom_id text DEFAULT NULL)
|
||||||
|
|
||||||
|
RETURNS SETOF cdb_dataservices_client.obs_meta_timespan AS $$
|
||||||
|
CONNECT cdb_dataservices_client._server_conn_str();
|
||||||
|
|
||||||
|
SELECT * FROM cdb_dataservices_server.obs_getavailabletimespans (username, organization_name, bounds, filter_tags, numer_id, denom_id, geom_id);
|
||||||
|
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_client._obs_legacybuildermetadata (username text, organization_name text, aggregate_type text DEFAULT NULL)
|
||||||
|
|
||||||
|
RETURNS TABLE(name text, subsection json) AS $$
|
||||||
|
CONNECT cdb_dataservices_client._server_conn_str();
|
||||||
|
|
||||||
|
SELECT * FROM cdb_dataservices_server.obs_legacybuildermetadata (username, organization_name, aggregate_type);
|
||||||
|
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
GRANT EXECUTE ON FUNCTION cdb_dataservices_client.obs_getavailablenumerators(bounds geometry(Geometry, 4326), filter_tags text[], denom_id text, geom_id text, timespan text) TO publicuser;
|
||||||
|
GRANT EXECUTE ON FUNCTION cdb_dataservices_client.obs_getavailabledenominators(bounds geometry(Geometry, 4326), filter_tags text[], numer_id text, geom_id text, timespan text) TO publicuser;
|
||||||
|
GRANT EXECUTE ON FUNCTION cdb_dataservices_client.obs_getavailablegeometries(bounds geometry(Geometry, 4326), filter_tags text[], numer_id text, denom_id text, timespan text) TO publicuser;
|
||||||
|
GRANT EXECUTE ON FUNCTION cdb_dataservices_client.obs_getavailabletimespans(bounds geometry(Geometry, 4326), filter_tags text[], numer_id text, denom_id text, geom_id text) TO publicuser;
|
||||||
|
GRANT EXECUTE ON FUNCTION cdb_dataservices_client.obs_legacybuildermetadata(aggregate_type text) TO publicuser;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
--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.11.1'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client.obs_getavailablenumerators (geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client.obs_getavailabledenominators (geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client.obs_getavailablegeometries (geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client.obs_getavailabletimespans (geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client.obs_legacybuildermetadata(text);
|
||||||
|
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client._obs_getavailablenumerators (text, text, geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client._obs_getavailabledenominators (text, text, geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client._obs_getavailablegeometries (text, text, geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client._obs_getavailabletimespans (text, text, geometry(Geometry, 4326), text[], text, text, text);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_client._obs_legacybuildermetadata(text, text, text);
|
||||||
|
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_client.obs_meta_numerator;
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_client.obs_meta_denominator;
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_client.obs_meta_geometry;
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_client.obs_meta_timespan;
|
||||||
1987
client/old_versions/cdb_dataservices_client--0.12.0.sql
Normal file
1987
client/old_versions/cdb_dataservices_client--0.12.0.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -326,3 +326,54 @@
|
|||||||
no_params: true
|
no_params: true
|
||||||
params:
|
params:
|
||||||
- {}
|
- {}
|
||||||
|
|
||||||
|
- name: obs_getavailablenumerators
|
||||||
|
return_type: SETOF cdb_dataservices_client.obs_meta_numerator
|
||||||
|
multi_row: true
|
||||||
|
multi_field: true
|
||||||
|
params:
|
||||||
|
- { name: bounds, type: "geometry(Geometry, 4326)", default: 'NULL' }
|
||||||
|
- { name: filter_tags, type: "text[]", default: 'NULL' }
|
||||||
|
- { name: denom_id, type: text, default: 'NULL' }
|
||||||
|
- { name: geom_id, type: text, default: 'NULL' }
|
||||||
|
- { name: timespan, type: text, default: 'NULL'}
|
||||||
|
|
||||||
|
- name: obs_getavailabledenominators
|
||||||
|
return_type: SETOF cdb_dataservices_client.obs_meta_denominator
|
||||||
|
multi_row: true
|
||||||
|
multi_field: true
|
||||||
|
params:
|
||||||
|
- { name: bounds, type: "geometry(Geometry, 4326)", default: 'NULL' }
|
||||||
|
- { name: filter_tags, type: "text[]", default: 'NULL' }
|
||||||
|
- { name: numer_id, type: text, default: 'NULL' }
|
||||||
|
- { name: geom_id, type: text, default: 'NULL' }
|
||||||
|
- { name: timespan, type: text, default: 'NULL'}
|
||||||
|
|
||||||
|
- name: obs_getavailablegeometries
|
||||||
|
return_type: SETOF cdb_dataservices_client.obs_meta_geometry
|
||||||
|
multi_row: true
|
||||||
|
multi_field: true
|
||||||
|
params:
|
||||||
|
- { name: bounds, type: "geometry(Geometry, 4326)", default: 'NULL' }
|
||||||
|
- { name: filter_tags, type: "text[]", default: 'NULL' }
|
||||||
|
- { name: numer_id, type: text, default: 'NULL' }
|
||||||
|
- { name: denom_id, type: text, default: 'NULL' }
|
||||||
|
- { name: timespan, type: text, default: 'NULL'}
|
||||||
|
|
||||||
|
- name: obs_getavailabletimespans
|
||||||
|
return_type: SETOF cdb_dataservices_client.obs_meta_timespan
|
||||||
|
multi_row: true
|
||||||
|
multi_field: true
|
||||||
|
params:
|
||||||
|
- { name: bounds, type: "geometry(Geometry, 4326)", default: 'NULL' }
|
||||||
|
- { name: filter_tags, type: "text[]", default: 'NULL' }
|
||||||
|
- { name: numer_id, type: text, default: 'NULL' }
|
||||||
|
- { name: denom_id, type: text, default: 'NULL' }
|
||||||
|
- { name: geom_id, type: text, default: 'NULL'}
|
||||||
|
|
||||||
|
- name: obs_legacybuildermetadata
|
||||||
|
return_type: TABLE(name text, subsection json)
|
||||||
|
multi_row: true
|
||||||
|
multi_field: true
|
||||||
|
params:
|
||||||
|
- { name: aggregate_type, type: text, default: 'NULL' }
|
||||||
|
|||||||
@@ -9,3 +9,12 @@ CREATE TYPE cdb_dataservices_client.simple_route AS (
|
|||||||
length real,
|
length real,
|
||||||
duration integer
|
duration integer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- For the OBS_Meta functions
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_numerator AS (numer_id text, numer_name text, numer_description text, numer_weight text, numer_license text, numer_source text, numer_type text, numer_aggregate text, numer_extra jsonb, numer_tags jsonb, valid_denom boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_denominator AS (denom_id text, denom_name text, denom_description text, denom_weight text, denom_license text, denom_source text, denom_type text, denom_aggregate text, denom_extra jsonb, denom_tags jsonb, valid_numer boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean, score numeric, numtiles bigint, notnull_percent numeric, numgeoms numeric, percentfill numeric, estnumgeoms numeric, meanmediansize numeric);
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_client.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean);
|
||||||
|
|||||||
5
client/upgrade_downgrade_template.erb
Normal file
5
client/upgrade_downgrade_template.erb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
--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 '<%= version %>'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
@@ -215,7 +215,7 @@ INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_namedplace_point('New York
|
|||||||
|
|
||||||
## Postal Code Geocoder
|
## Postal Code Geocoder
|
||||||
|
|
||||||
This function geocodes your data into point, or polygon, geometries for postal codes. The postal code polygon geocoder covers the United States, France, Australia and Canada; a request for a different country will return an empty response.
|
These functions geocode your data into point, or polygon, geometries for postal codes. The postal code geocoder covers the United States, France, Australia and Canada; a request for a different country will return an empty response.
|
||||||
|
|
||||||
**Note:** For the USA, US Census [Zip Code Tabulation Areas](https://www.census.gov/geo/reference/zctas.html) (ZCTA) are used to reference geocodes for USPS postal codes service areas. See the [FAQs](https://carto.com/docs/faqs/datasets-and-data/#why-does-carto-use-census-bureau-zctas-and-not-usps-zip-codes-for-postal-codes) about datasets and data for details.
|
**Note:** For the USA, US Census [Zip Code Tabulation Areas](https://www.census.gov/geo/reference/zctas.html) (ZCTA) are used to reference geocodes for USPS postal codes service areas. See the [FAQs](https://carto.com/docs/faqs/datasets-and-data/#why-does-carto-use-census-bureau-zctas-and-not-usps-zip-codes-for-postal-codes) about datasets and data for details.
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ _The Data Services API is collaborating with [Mapzen](https://mapzen.com/), and
|
|||||||
|
|
||||||
By using the SQL API to query the Data Services API functions, you can manage specific operations and the corresponding geometries (a `polygon` or a `point`), according to the input information.
|
By using the SQL API to query the Data Services API functions, you can manage specific operations and the corresponding geometries (a `polygon` or a `point`), according to the input information.
|
||||||
|
|
||||||
The Data Services API decouples the geocoding and isoline services from the CARTO Editor. The API allows you to geocode data (from single rows, complete datasets, or simple inputs) and to perform trade areas analysis (computing isodistances or isochrones) programatically, through authenticated requests.
|
The Data Services API also exposes its services directly through CARTO Builder. For example, you can geocode data (from single rows, complete datasets, or simple inputs) and perform trade areas analysis (computing isodistances or isochrones) programatically, through authenticated SQL requests, or by using the ANALYSIS options.
|
||||||
|
|
||||||
The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/).
|
The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/).
|
||||||
|
|
||||||
|
|||||||
12
server/extension/cdb_dataservices_server--0.18.0--0.18.1.sql
Normal file
12
server/extension/cdb_dataservices_server--0.18.0--0.18.1.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--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.18.1'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE score numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE numtiles bigint;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE notnull_percent numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE numgeoms numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE percentfill numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE estnumgeoms numeric;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry ADD ATTRIBUTE meanmediansize numeric;
|
||||||
12
server/extension/cdb_dataservices_server--0.18.1--0.18.0.sql
Normal file
12
server/extension/cdb_dataservices_server--0.18.1--0.18.0.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--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.18.0'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE score;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE numtiles;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE notnull_percent;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE numgeoms;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE percentfill;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE estnumgeoms;
|
||||||
|
ALTER TYPE cdb_dataservices_server.obs_meta_geometry DROP ATTRIBUTE meanmediansize;
|
||||||
2564
server/extension/cdb_dataservices_server--0.18.1.sql
Normal file
2564
server/extension/cdb_dataservices_server--0.18.1.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
comment = 'CartoDB dataservices server extension'
|
comment = 'CartoDB dataservices server extension'
|
||||||
default_version = '0.17.0'
|
default_version = '0.18.1'
|
||||||
requires = 'plpythonu, plproxy, postgis, cdb_geocoder'
|
requires = 'plpythonu, plproxy, postgis, cdb_geocoder'
|
||||||
superuser = true
|
superuser = true
|
||||||
schema = cdb_dataservices_server
|
schema = cdb_dataservices_server
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
--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.18.0'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_numerator AS (numer_id text, numer_name text, numer_description text, numer_weight text, numer_license text, numer_source text, numer_type text, numer_aggregate text, numer_extra jsonb, numer_tags jsonb, valid_denom boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableNumerators(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
denom_id TEXT DEFAULT NULL,
|
||||||
|
geom_id TEXT DEFAULT NULL,
|
||||||
|
timespan TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_numerator AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableNumerators(bounds, filter_tags, denom_id, geom_id, timespan);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_denominator AS (denom_id text, denom_name text, denom_description text, denom_weight text, denom_license text, denom_source text, denom_type text, denom_aggregate text, denom_extra jsonb, denom_tags jsonb, valid_numer boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableDenominators(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
numer_id TEXT DEFAULT NULL,
|
||||||
|
geom_id TEXT DEFAULT NULL,
|
||||||
|
timespan TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_denominator AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableDenominators(bounds, filter_tags, numer_id, geom_id, timespan);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableGeometries(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
numer_id TEXT DEFAULT NULL,
|
||||||
|
denom_id TEXT DEFAULT NULL,
|
||||||
|
timespan TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_geometry AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableGeometries(bounds, filter_tags, numer_id, denom_id, timespan);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableTimespans(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
numer_id TEXT DEFAULT NULL,
|
||||||
|
denom_id TEXT DEFAULT NULL,
|
||||||
|
geom_id TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_timespan AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableTimespans(bounds, filter_tags, numer_id, denom_id, geom_id);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_LegacyBuilderMetadata(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
aggregate_type TEXT DEFAULT NULL)
|
||||||
|
RETURNS TABLE(name TEXT, subsection JSON) AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_LegacyBuilderMetadata(aggregate_type);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
@@ -146,7 +146,7 @@ RETURNS text AS $$
|
|||||||
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
plpy.execute("SELECT cdb_dataservices_server._get_obs_snapshot_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
plpy.execute("SELECT cdb_dataservices_server._get_obs_snapshot_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
|
||||||
user_obs_config = GD["user_obs_config_{0}".format(username)]
|
user_obs_config = GD["user_obs_snapshot_config_{0}".format(username)]
|
||||||
|
|
||||||
return user_obs_config.connection_str
|
return user_obs_config.connection_str
|
||||||
$$ LANGUAGE plpythonu;
|
$$ LANGUAGE plpythonu;
|
||||||
@@ -2423,6 +2423,7 @@ $$ LANGUAGE plpythonu;
|
|||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[])
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[])
|
||||||
RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
||||||
from cartodb_services.metrics import metrics
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.tools import Logger
|
||||||
|
|
||||||
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
--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.17.0'" to load this file. \quit
|
||||||
|
|
||||||
|
-- HERE goes your code to upgrade/downgrade
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_server.obs_getavailablenumerators(TEXT, TEXT, geometry(Geometry, 4326), TEXT[], TEXT, TEXT, TEXT);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_server.obs_getavailabledenominators(TEXT, TEXT, geometry(Geometry, 4326), TEXT[], TEXT, TEXT, TEXT);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_server.obs_getavailablegeometries(TEXT, TEXT, geometry(Geometry, 4326), TEXT[], TEXT, TEXT, TEXT);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_server.obs_getavailabletimespans(TEXT, TEXT, geometry(Geometry, 4326), TEXT[], TEXT, TEXT, TEXT);
|
||||||
|
DROP FUNCTION IF EXISTS cdb_dataservices_server.obs_legacybuildermetadata(TEXT, TEXT, TEXT);
|
||||||
|
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_numerator;
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_denominator;
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_geometry;
|
||||||
|
DROP TYPE IF EXISTS cdb_dataservices_server.obs_meta_timespan;
|
||||||
2564
server/extension/old_versions/cdb_dataservices_server--0.18.0.sql
Normal file
2564
server/extension/old_versions/cdb_dataservices_server--0.18.0.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ RETURNS TABLE(id text, description text, name text, aggregate text, source text)
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_search', user_obs_snapshot_config, logger):
|
with metrics('obs_search', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_Search($1, $2, $3, $4);", ["text", "text", "text", "text"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_Search($1, $2, $3, $4);", ["text", "text", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, search_term, relevant_boundary])
|
result = plpy.execute(obs_plan, [username, orgname, search_term, relevant_boundary])
|
||||||
@@ -89,7 +89,7 @@ RETURNS TABLE(boundary_id text, description text, time_span text, tablename text
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getavailableboundaries', user_obs_snapshot_config, logger):
|
with metrics('obs_getavailableboundaries', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetAvailableBoundaries($1, $2, $3, $4) as available_boundaries;", ["text", "text", "geometry(Geometry, 4326)", "text"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetAvailableBoundaries($1, $2, $3, $4) as available_boundaries;", ["text", "text", "geometry(Geometry, 4326)", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, time_span])
|
result = plpy.execute(obs_plan, [username, orgname, geom, time_span])
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ RETURNS geometry(Geometry, 4326) AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getboundary', user_obs_snapshot_config, logger):
|
with metrics('obs_getboundary', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetBoundary($1, $2, $3, $4) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text"])
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetBoundary($1, $2, $3, $4) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span])
|
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span])
|
||||||
@@ -85,7 +85,7 @@ RETURNS TEXT AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getboundaryid', user_obs_snapshot_config, logger):
|
with metrics('obs_getboundaryid', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetBoundaryId($1, $2, $3, $4, $5) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text"])
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetBoundaryId($1, $2, $3, $4, $5) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span])
|
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span])
|
||||||
@@ -138,7 +138,7 @@ RETURNS geometry(Geometry, 4326) AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getboundarybyid', user_obs_snapshot_config, logger):
|
with metrics('obs_getboundarybyid', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetBoundaryById($1, $2, $3, $4, $5) as boundary;", ["text", "text", "text", "text", "text"])
|
obs_plan = plpy.prepare("SELECT cdb_dataservices_server._OBS_GetBoundaryById($1, $2, $3, $4, $5) as boundary;", ["text", "text", "text", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geometry_id, boundary_id, time_span])
|
result = plpy.execute(obs_plan, [username, orgname, geometry_id, boundary_id, time_span])
|
||||||
@@ -193,7 +193,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getboundariesbygeometry', user_obs_snapshot_config, logger):
|
with metrics('obs_getboundariesbygeometry', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetBoundariesByGeometry($1, $2, $3, $4, $5, $6) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text", "text"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetBoundariesByGeometry($1, $2, $3, $4, $5, $6) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span, overlap_type])
|
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span, overlap_type])
|
||||||
@@ -255,7 +255,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getboundariesbypointandradius', user_obs_snapshot_config, logger):
|
with metrics('obs_getboundariesbypointandradius', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius($1, $2, $3, $4, $5, $6, $7) as boundary;", ["text", "text", "geometry(Point, 4326)", "numeric", "text", "text", "text"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetBoundariesByPointAndRadius($1, $2, $3, $4, $5, $6, $7) as boundary;", ["text", "text", "geometry(Point, 4326)", "numeric", "text", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, radius, boundary_id, time_span, overlap_type])
|
result = plpy.execute(obs_plan, [username, orgname, geom, radius, boundary_id, time_span, overlap_type])
|
||||||
@@ -315,7 +315,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getpointsbygeometry', user_obs_snapshot_config, logger):
|
with metrics('obs_getpointsbygeometry', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetPointsByGeometry($1, $2, $3, $4, $5, $6) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text", "text"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetPointsByGeometry($1, $2, $3, $4, $5, $6) as boundary;", ["text", "text", "geometry(Point, 4326)", "text", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span, overlap_type])
|
result = plpy.execute(obs_plan, [username, orgname, geom, boundary_id, time_span, overlap_type])
|
||||||
@@ -377,7 +377,7 @@ RETURNS TABLE(the_geom geometry, geom_refs text) AS $$
|
|||||||
if not quota_service.check_user_quota():
|
if not quota_service.check_user_quota():
|
||||||
raise Exception('You have reached the limit of your quota')
|
raise Exception('You have reached the limit of your quota')
|
||||||
|
|
||||||
with metrics('obs_getpointsbypointandradius', user_obs_snapshot_config, logger):
|
with metrics('obs_getpointsbypointandradius', user_obs_config, logger):
|
||||||
try:
|
try:
|
||||||
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetPointsByPointAndRadius($1, $2, $3, $4, $5, $6, $7) as boundary;", ["text", "text", "geometry(Point, 4326)", "numeric", "text", "text", "text"])
|
obs_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server._OBS_GetPointsByPointAndRadius($1, $2, $3, $4, $5, $6, $7) as boundary;", ["text", "text", "geometry(Point, 4326)", "numeric", "text", "text", "text"])
|
||||||
result = plpy.execute(obs_plan, [username, orgname, geom, radius, boundary_id, time_span, overlap_type])
|
result = plpy.execute(obs_plan, [username, orgname, geom, radius, boundary_id, time_span, overlap_type])
|
||||||
|
|||||||
@@ -3,3 +3,73 @@ RETURNS text AS $$
|
|||||||
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
SELECT cdb_observatory.obs_dumpversion();
|
SELECT cdb_observatory.obs_dumpversion();
|
||||||
$$ LANGUAGE plproxy;
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
-- We could create a super type for the common data like id, name and so on but we need to parse inside the functions because the -- the return data tha comes from OBS is a TABLE() with them
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_numerator AS (numer_id text, numer_name text, numer_description text, numer_weight text, numer_license text, numer_source text, numer_type text, numer_aggregate text, numer_extra jsonb, numer_tags jsonb, valid_denom boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableNumerators(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
denom_id TEXT DEFAULT NULL,
|
||||||
|
geom_id TEXT DEFAULT NULL,
|
||||||
|
timespan TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_numerator AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableNumerators(bounds, filter_tags, denom_id, geom_id, timespan);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_denominator AS (denom_id text, denom_name text, denom_description text, denom_weight text, denom_license text, denom_source text, denom_type text, denom_aggregate text, denom_extra jsonb, denom_tags jsonb, valid_numer boolean, valid_geom boolean, valid_timespan boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableDenominators(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
numer_id TEXT DEFAULT NULL,
|
||||||
|
geom_id TEXT DEFAULT NULL,
|
||||||
|
timespan TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_denominator AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableDenominators(bounds, filter_tags, numer_id, geom_id, timespan);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean, score numeric, numtiles bigint, notnull_percent numeric, numgeoms numeric, percentfill numeric, estnumgeoms numeric, meanmediansize numeric);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableGeometries(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
numer_id TEXT DEFAULT NULL,
|
||||||
|
denom_id TEXT DEFAULT NULL,
|
||||||
|
timespan TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_geometry AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableGeometries(bounds, filter_tags, numer_id, denom_id, timespan);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE TYPE cdb_dataservices_server.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAvailableTimespans(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
bounds geometry(Geometry, 4326) DEFAULT NULL,
|
||||||
|
filter_tags TEXT[] DEFAULT NULL,
|
||||||
|
numer_id TEXT DEFAULT NULL,
|
||||||
|
denom_id TEXT DEFAULT NULL,
|
||||||
|
geom_id TEXT DEFAULT NULL)
|
||||||
|
RETURNS SETOF cdb_dataservices_server.obs_meta_timespan AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_GetAvailableTimespans(bounds, filter_tags, numer_id, denom_id, geom_id);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_LegacyBuilderMetadata(
|
||||||
|
username TEXT,
|
||||||
|
orgname TEXT,
|
||||||
|
aggregate_type TEXT DEFAULT NULL)
|
||||||
|
RETURNS TABLE(name TEXT, subsection JSON) AS $$
|
||||||
|
CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname);
|
||||||
|
SELECT * FROM cdb_observatory.OBS_LegacyBuilderMetadata(aggregate_type);
|
||||||
|
$$ LANGUAGE plproxy;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[])
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isochrone(username TEXT, orgname TEXT, source geometry(Geometry, 4326), mode TEXT, range integer[], options text[] DEFAULT array[]::text[])
|
||||||
RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
RETURNS SETOF cdb_dataservices_server.isoline AS $$
|
||||||
from cartodb_services.metrics import metrics
|
from cartodb_services.metrics import metrics
|
||||||
|
from cartodb_services.tools import Logger
|
||||||
|
|
||||||
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
plpy.execute("SELECT cdb_dataservices_server._connect_to_redis('{0}')".format(username))
|
||||||
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
redis_conn = GD["redis_connection_{0}".format(username)]['redis_metrics_connection']
|
||||||
|
|||||||
@@ -185,3 +185,58 @@ SELECT exists(SELECT *
|
|||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailablenumerators'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
exists
|
||||||
|
--------
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailabledenominators'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
exists
|
||||||
|
--------
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailablegeometries'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
exists
|
||||||
|
--------
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailabletimespans'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
exists
|
||||||
|
--------
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_legacybuildermetadata'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
||||||
|
exists
|
||||||
|
--------
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
|||||||
@@ -116,3 +116,38 @@ SELECT exists(SELECT *
|
|||||||
WHERE ns.nspname = 'cdb_dataservices_server'
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
AND proname = 'obs_getpointsbypointandradius'
|
AND proname = 'obs_getpointsbypointandradius'
|
||||||
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, numeric, text, text, text');
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, numeric, text, text, text');
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailablenumerators'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailabledenominators'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailablegeometries'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_getavailabletimespans'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, geometry, text[], text, text, text');
|
||||||
|
|
||||||
|
SELECT exists(SELECT *
|
||||||
|
FROM pg_proc p
|
||||||
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||||
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
||||||
|
AND proname = 'obs_legacybuildermetadata'
|
||||||
|
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class MapzenGeocoderConfigBuilder(object):
|
|||||||
period_end_date = date_parse(period_end_date_str)
|
period_end_date = date_parse(period_end_date_str)
|
||||||
|
|
||||||
logger_conf = self._server_conf.get('logger_conf')
|
logger_conf = self._server_conf.get('logger_conf')
|
||||||
log_path = logger_conf['geocoder_log_path']
|
log_path = logger_conf.get('geocoder_log_path', None)
|
||||||
|
|
||||||
return MapzenGeocoderConfig(geocoding_quota,
|
return MapzenGeocoderConfig(geocoding_quota,
|
||||||
soft_geocoding_limit,
|
soft_geocoding_limit,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ This are the automatic integration tests for geocoder api (both client and serve
|
|||||||
In order to execute the tests you have to execute the `run_tests.py` python script:
|
In order to execute the tests you have to execute the `run_tests.py` python script:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python run_tests.py [--host=cartodb.com] username api_key
|
python run_tests.py [--host=cartodb.com --schema=https] username api_key
|
||||||
```
|
```
|
||||||
|
|
||||||
You can define the host where is going to execute the SQL API queries to test the
|
You can define the host where is going to execute the SQL API queries to test the
|
||||||
|
|||||||
@@ -231,3 +231,62 @@ class TestDataObservatoryFunctions(TestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
assert_equal(e.message[0], "The api_key must be provided")
|
assert_equal(e.message[0], "The api_key must be provided")
|
||||||
|
|
||||||
|
def test_if_obs_get_legacy_builder_metadata_is_ok(self):
|
||||||
|
query = "SELECT name FROM OBS_LegacyBuilderMetadata() LIMIT 1;&api_key={0}".format(self.env_variables['api_key'])
|
||||||
|
result = IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
assert_not_equal(result['name'], None)
|
||||||
|
|
||||||
|
def test_if_obs_get_points_by_point_and_radius_without_api_key_raise_error(self):
|
||||||
|
query = "SELECT name FROM OBS_LegacyBuilderMetadata() LIMIT 1;"
|
||||||
|
try:
|
||||||
|
IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
except Exception as e:
|
||||||
|
assert_equal(e.message[0], "The api_key must be provided")
|
||||||
|
|
||||||
|
def test_if_obs_get_available_numerators_is_ok(self):
|
||||||
|
query = "SELECT numer_id FROM OBS_GetAvailableNumerators() LIMIT 1;&api_key={0}".format(self.env_variables['api_key'])
|
||||||
|
result = IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
assert_not_equal(result['numer_id'], None)
|
||||||
|
|
||||||
|
def test_if_obs_get_available_numerators_without_api_key_raise_error(self):
|
||||||
|
query = "SELECT numer_id FROM OBS_GetAvailableNumerators() LIMIT 1;"
|
||||||
|
try:
|
||||||
|
IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
except Exception as e:
|
||||||
|
assert_equal(e.message[0], "The api_key must be provided")
|
||||||
|
|
||||||
|
def test_if_obs_get_available_denominators_is_ok(self):
|
||||||
|
query = "SELECT denom_id FROM OBS_GetAvailableDenominators() LIMIT 1;&api_key={0}".format(self.env_variables['api_key'])
|
||||||
|
result = IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
assert_not_equal(result['denom_id'], None)
|
||||||
|
|
||||||
|
def test_if_obs_get_available_denominators_without_api_key_raise_error(self):
|
||||||
|
query = "SELECT denom_id FROM OBS_GetAvailableDenominators() LIMIT 1;"
|
||||||
|
try:
|
||||||
|
IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
except Exception as e:
|
||||||
|
assert_equal(e.message[0], "The api_key must be provided")
|
||||||
|
|
||||||
|
def test_if_obs_get_available_geometries_is_ok(self):
|
||||||
|
query = "SELECT geom_id FROM OBS_GetAvailableGeometries() LIMIT 1;&api_key={0}".format(self.env_variables['api_key'])
|
||||||
|
result = IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
assert_not_equal(result['geom_id'], None)
|
||||||
|
|
||||||
|
def test_if_obs_get_available_geometries_without_api_key_raise_error(self):
|
||||||
|
query = "SELECT geom_id FROM OBS_GetAvailableGeometries() LIMIT 1;"
|
||||||
|
try:
|
||||||
|
IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
except Exception as e:
|
||||||
|
assert_equal(e.message[0], "The api_key must be provided")
|
||||||
|
|
||||||
|
def test_if_obs_get_available_timespans_is_ok(self):
|
||||||
|
query = "SELECT timespan_id FROM OBS_GetAvailableTimespans() LIMIT 1;&api_key={0}".format(self.env_variables['api_key'])
|
||||||
|
result = IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
assert_not_equal(result['timespan_id'], None)
|
||||||
|
|
||||||
|
def test_if_obs_get_available_timespans_without_api_key_raise_error(self):
|
||||||
|
query = "SELECT timespan_id FROM OBS_GetAvailableTimespans() LIMIT 1;"
|
||||||
|
try:
|
||||||
|
IntegrationTestHelper.execute_query(self.sql_api_url, query)
|
||||||
|
except Exception as e:
|
||||||
|
assert_equal(e.message[0], "The api_key must be provided")
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ class TestStreetFunctions(TestCase):
|
|||||||
self.env_variables['api_key']
|
self.env_variables['api_key']
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_if_select_with_here_street_point_is_ok(self):
|
def test_if_select_with_street_point_is_ok(self):
|
||||||
query = "SELECT cdb_here_geocode_street_point(street) " \
|
query = "SELECT cdb_geocode_street_point(street) " \
|
||||||
"as geometry FROM {0} LIMIT 1&api_key={1}".format(
|
"as geometry FROM {0} LIMIT 1&api_key={1}".format(
|
||||||
self.env_variables['table_name'],
|
self.env_variables['table_name'],
|
||||||
self.env_variables['api_key'])
|
self.env_variables['api_key'])
|
||||||
|
|||||||
Reference in New Issue
Block a user