Compare commits

...

18 Commits

Author SHA1 Message Date
Mario de Frutos
27806ead54 Merge pull request #307 from CartoDB/development
Release client 0.12.0 and server 0.18.0
2016-11-11 14:14:10 +01:00
Mario de Frutos
d1b17da70b Don't make mandatory to have a metrics file 2016-11-11 11:48:08 +01:00
Mario de Frutos
b5f4c507b3 Fixed some typos in SQL artifact v0.18 and v0.17 2016-11-11 11:13:08 +01:00
Mario de Frutos
d65a0d9ac5 Integration tests for the meta functions 2016-11-11 10:20:20 +01:00
Mario de Frutos
08debb83ed Server side change JSONB to JSON in the legacybuildermedatada function 2016-11-10 18:08:35 +01:00
Mario de Frutos
dac5e76e98 Changed JSONB in legacybuildermetadata function to JSON 2016-11-10 18:07:06 +01:00
Mario de Frutos
4945b4d0bf Server version 0.18.0 artifact 2016-11-10 16:03:08 +01:00
Mario de Frutos
e6963198dc Client version 0.12.0 artifact 2016-11-10 16:02:58 +01:00
Mario de Frutos
9ae04aaad2 Merge pull request #303 from CartoDB/287_wrapper_dimensional_obs_meta
287 wrapper dimensional obs meta
2016-11-10 16:01:45 +01:00
Mario de Frutos
b392eaf74b removed manual call to here geocoder 2016-11-10 16:00:25 +01:00
Mario de Frutos
040b094b01 New observatory meta functions for server side 2016-11-10 11:29:19 +01:00
Mario de Frutos
a006f76285 New server version 0.18.0 2016-11-10 11:29:18 +01:00
Mario de Frutos
38f2592b22 Client addition of observatory meta functions 2016-11-10 11:29:18 +01:00
Mario de Frutos
94099540d7 New version 0.12.0 sql files 2016-11-09 11:21:29 +01:00
Mario de Frutos
b403e1d69a Move old 0.11.1 version to a proper folder 2016-11-09 11:21:29 +01:00
Mario de Frutos
623faf1a22 Added make release option for client 2016-11-09 11:21:28 +01:00
Mario de Frutos
7d9dc554c5 Update README.md 2016-11-07 12:14:05 +01:00
Mario de Frutos
fffb64de36 Update NEWS 2016-11-07 12:09:25 +01:00
29 changed files with 5227 additions and 72 deletions

95
NEWS.md
View File

@@ -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
@@ -39,7 +58,7 @@ August 11, 2016
=========== ===========
* Released server version 0.14.2 * Released server version 0.14.2
* Released client version 0.10.2 * Released client version 0.10.2
* Always default arguments for DO functions to NULL, which prevents duplication & overwrite * Always default arguments for DO functions to NULL, which prevents duplication & overwrite
August 5, 2016 August 5, 2016
=========== ===========
@@ -95,7 +114,7 @@ July 15, 2016:
* __OBS_ConnectUserTable * __OBS_ConnectUserTable
This change does not require any client change. This change does not require any client change.
https://github.com/CartoDB/dataservices-api/releases/tag/0.13.1-server https://github.com/CartoDB/dataservices-api/releases/tag/0.13.1-server
Jul 12, 2016: Jul 12, 2016:
@@ -105,14 +124,14 @@ Jul 12, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.13.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.13.0-server
Jul 12, 2016: Jul 12, 2016:
=========== ===========
* Release client 0.10.0 * Release client 0.10.0
* [Client] Add beta augment functions, isoline fixes, observatory dump version * [Client] Add beta augment functions, isoline fixes, observatory dump version
https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-client
Jul 7, 2016: Jul 7, 2016:
=========== ===========
* Release client 0.9.0 * Release client 0.9.0
* This release adds two new functions in the Data Services extension client: * This release adds two new functions in the Data Services extension client:
@@ -122,7 +141,7 @@ Jul 7, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.9.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.9.0-client
Jul 7, 2016: Jul 7, 2016:
=========== ===========
* Release server 0.12.0 * Release server 0.12.0
* This release adds four new functions in the Data Services extension server: * This release adds four new functions in the Data Services extension server:
@@ -134,7 +153,7 @@ Jul 7, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.12.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.12.0-server
Jul 5, 2016: Jul 5, 2016:
=========== ===========
* Release server 0.11.0 * Release server 0.11.0
* Added three new public functions for each geocoding provider: * Added three new public functions for each geocoding provider:
@@ -147,40 +166,40 @@ Jul 5, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.11.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.11.0-server
Jul 5, 2016: Jul 5, 2016:
=========== ===========
* Release client 0.8.0 * Release client 0.8.0
* Expose providers in high-precision geocoder functions * Expose providers in high-precision geocoder functions
https://github.com/CartoDB/dataservices-api/releases/tag/0.8.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.8.0-client
Jun 15, 2016: Jun 15, 2016:
=========== ===========
* [server python] Write quota info from services with zero padding. Closes issue #204. * [server python] Write quota info from services with zero padding. Closes issue #204.
https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-server3 https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-server3
Jun 13, 2016: Jun 13, 2016:
=========== ===========
* [server python] Read quota info from services with and without zero padding. Closes issue #201. * [server python] Read quota info from services with and without zero padding. Closes issue #201.
https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-server2 https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-server2
May 31, 2016: May 31, 2016:
=========== ===========
* Release client 0.7.0 * Release client 0.7.0
* Adds new function OBS_GetMeasureById * Adds new function OBS_GetMeasureById
https://github.com/CartoDB/dataservices-api/releases/tag/0.7.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.7.0-client
May 31, 2016: May 31, 2016:
=========== ===========
* Release server 0.10.0 * Release server 0.10.0
* Adds new function OBS_GetMeasureById * Adds new function OBS_GetMeasureById
https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.10.0-server
May 25, 2016: May 25, 2016:
=========== ===========
* Release server 0.9.0 * Release server 0.9.0
* Added a new routing function which allows to generate routes from an origin to a destination, which passes through a set of defined locations: * Added a new routing function which allows to generate routes from an origin to a destination, which passes through a set of defined locations:
@@ -197,7 +216,7 @@ May 25, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.9.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.9.0-server
May 25, 2016: May 25, 2016:
=========== ===========
* Release client 0.6.0 * Release client 0.6.0
* Includes new client function to obtain a route with waypoints: * Includes new client function to obtain a route with waypoints:
@@ -205,7 +224,7 @@ May 25, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.6.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.6.0-client
May 18, 2016: May 18, 2016:
=========== ===========
* Release client 0.5.0 * Release client 0.5.0
* Added new functions for the data observatory: * Added new functions for the data observatory:
@@ -228,7 +247,7 @@ May 18, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.5.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.5.0-client
May 18, 2016: May 18, 2016:
=========== ===========
* Release server 0.8.0: Data Observatory release * Release server 0.8.0: Data Observatory release
* Added new functions for the data observatory: * Added new functions for the data observatory:
@@ -252,28 +271,28 @@ May 18, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.8.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.8.0-server
May 10, 2016: May 10, 2016:
=========== ===========
* Release server 0.7.4 * Release server 0.7.4
* In case we receive a 4xx error from one of the services: isolines, here geocoder, etc we have to return an empty value an increment the empty counter. We have to raise exception in 5xx or unhandled exceptions * In case we receive a 4xx error from one of the services: isolines, here geocoder, etc we have to return an empty value an increment the empty counter. We have to raise exception in 5xx or unhandled exceptions
https://github.com/CartoDB/dataservices-api/releases/tag/0.7.4-server https://github.com/CartoDB/dataservices-api/releases/tag/0.7.4-server
May 10, 2016: May 10, 2016:
=========== ===========
* Release server 0.7.3 * Release server 0.7.3
* Change how the blue/green system is working in the server side. Now the loopback is only in the observatory extension functions call instead in all the dataservices-api function for observatory * Change how the blue/green system is working in the server side. Now the loopback is only in the observatory extension functions call instead in all the dataservices-api function for observatory
https://github.com/CartoDB/dataservices-api/releases/tag/0.7.3-server https://github.com/CartoDB/dataservices-api/releases/tag/0.7.3-server
May 4, 2016: May 4, 2016:
=========== ===========
* Release server 0.7.2 * Release server 0.7.2
* Added Blue/Green capability to the data observatory functions in order to be able to use staging or production databases * Added Blue/Green capability to the data observatory functions in order to be able to use staging or production databases
https://github.com/CartoDB/dataservices-api/releases/tag/0.7.2-server https://github.com/CartoDB/dataservices-api/releases/tag/0.7.2-server
Apr 25, 2016: Apr 25, 2016:
=========== ===========
* Release server 0.7.1 * Release server 0.7.1
* Use redis based config if exists, if not use the db config value * Use redis based config if exists, if not use the db config value
@@ -281,7 +300,7 @@ Apr 25, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.7.1-server https://github.com/CartoDB/dataservices-api/releases/tag/0.7.1-server
Apr 21, 2016: Apr 21, 2016:
=========== ===========
* Release client 0.4.0 * Release client 0.4.0
* Remove old versioning system for client side * Remove old versioning system for client side
@@ -291,7 +310,7 @@ Apr 21, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.4.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.4.0-client
Apr 21, 2016: Apr 21, 2016:
=========== ===========
* Release server 0.7.0 * Release server 0.7.0
* Added obs_get_demography_snapshot function * Added obs_get_demography_snapshot function
@@ -300,14 +319,14 @@ Apr 21, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.7.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.7.0-server
Apr 19, 2016: Apr 19, 2016:
=========== ===========
* Release server 0.6.2 * Release server 0.6.2
* Add Mapzen routing and geocoder quota check * Add Mapzen routing and geocoder quota check
https://github.com/CartoDB/dataservices-api/releases/tag/0.6.2-server https://github.com/CartoDB/dataservices-api/releases/tag/0.6.2-server
Apr 14, 2016: Apr 14, 2016:
=========== ===========
* Release server 0.6.1 * Release server 0.6.1
* Now the implementation knows how to get the iso3 for the passed country in order to pass it to Mapzen * Now the implementation knows how to get the iso3 for the passed country in order to pass it to Mapzen
@@ -328,8 +347,8 @@ Mar 28, 2016:
* Integrated Mapzen geocoder for street level geocoding function * Integrated Mapzen geocoder for street level geocoding function
https://github.com/CartoDB/dataservices-api/releases/tag/0.6.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.6.0-server
Mar 23, 2016: Mar 23, 2016:
=========== ===========
* Release server 0.5.2 * Release server 0.5.2
* Deleted old versioning system * Deleted old versioning system
@@ -338,7 +357,7 @@ Mar 23, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.5.2-server https://github.com/CartoDB/dataservices-api/releases/tag/0.5.2-server
Mar 17, 2016: Mar 17, 2016:
=========== ===========
* Release server 0.5.1 * Release server 0.5.1
* Renamed the python library metrics functions * Renamed the python library metrics functions
@@ -348,7 +367,7 @@ Mar 17, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.5.1-server https://github.com/CartoDB/dataservices-api/releases/tag/0.5.1-server
Mar 14, 2016: Mar 14, 2016:
=========== ===========
* Release server 0.5.0 * Release server 0.5.0
* Mapzen routing functions to calculate a route point to point * Mapzen routing functions to calculate a route point to point
@@ -356,28 +375,28 @@ Mar 14, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.5.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.5.0-server
Mar 14, 2016: Mar 14, 2016:
=========== ===========
* Release client 0.3.0 * Release client 0.3.0
* Added cdb_routing_point_to_point function using Mapzen as provider * Added cdb_routing_point_to_point function using Mapzen as provider
https://github.com/CartoDB/dataservices-api/releases/tag/0.3.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.3.0-client
Feb 26, 2016: Feb 26, 2016:
=========== ===========
* Release client 0.2.0 * Release client 0.2.0
* Added routing isolines capabilities to the client and public API * Added routing isolines capabilities to the client and public API
https://github.com/CartoDB/dataservices-api/releases/tag/0.2.0-client https://github.com/CartoDB/dataservices-api/releases/tag/0.2.0-client
Feb 26, 2016: Feb 26, 2016:
=========== ===========
* Release server 0.4.0 * Release server 0.4.0
* Added routing isolines capabilities * Added routing isolines capabilities
https://github.com/CartoDB/dataservices-api/releases/tag/0.4.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.4.0-server
Feb 11, 2016: Feb 11, 2016:
=========== ===========
* Release server 0.3.0 * Release server 0.3.0
* Extension refactor, now is called cdb_dataservices_[client|server] in order to include more services aside the geocoder. * Extension refactor, now is called cdb_dataservices_[client|server] in order to include more services aside the geocoder.
@@ -386,7 +405,7 @@ Feb 11, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.3.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.3.0-server
Feb 4, 2016: Feb 4, 2016:
=========== ===========
* Release server 0.2.0 * Release server 0.2.0
* Logic for the google geocoder so the users with this geocoder setted up can use street level geocoding too * Logic for the google geocoder so the users with this geocoder setted up can use street level geocoding too
@@ -394,7 +413,7 @@ Feb 4, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.2.0-server https://github.com/CartoDB/dataservices-api/releases/tag/0.2.0-server
Jan 25, 2016: Jan 25, 2016:
=========== ===========
* Release Geocoder API 0.1.0 * Release Geocoder API 0.1.0
* Street geocoding available through the cdb_geocoder_street_point_v2 function (only working Heremaps geocoder) * Street geocoding available through the cdb_geocoder_street_point_v2 function (only working Heremaps geocoder)
@@ -403,27 +422,27 @@ Jan 25, 2016:
https://github.com/CartoDB/dataservices-api/releases/tag/0.1.0 https://github.com/CartoDB/dataservices-api/releases/tag/0.1.0
Jan 25, 2016: Jan 25, 2016:
=========== ===========
* Release Geocoder API 0.0.1 production ready * Release Geocoder API 0.0.1 production ready
https://github.com/CartoDB/dataservices-api/releases/tag/0.0.1 https://github.com/CartoDB/dataservices-api/releases/tag/0.0.1
Dec 23, 2015: Dec 23, 2015:
=========== ===========
* Release Geocoder API 0.0.2 beta * Release Geocoder API 0.0.2 beta
https://github.com/CartoDB/dataservices-api/releases/tag/0.0.2 https://github.com/CartoDB/dataservices-api/releases/tag/0.0.2
Dec 3, 2015: Dec 3, 2015:
=========== ===========
* Release Geocoder API 0.0.1 Beta2 * Release Geocoder API 0.0.1 Beta2
https://github.com/CartoDB/dataservices-api/releases/tag/0.0.1-beta2 https://github.com/CartoDB/dataservices-api/releases/tag/0.0.1-beta2
Nov 27, 2015: Nov 27, 2015:
=========== ===========
* Release Geocoder API BETA 1 * Release Geocoder API BETA 1
* Added the organization public user to the api key check * Added the organization public user to the api key check
https://github.com/CartoDB/dataservices-api/releases/tag/0.0.1-beta https://github.com/CartoDB/dataservices-api/releases/tag/0.0.1-beta

View File

@@ -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)

View 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;

View File

@@ -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;

File diff suppressed because it is too large Load Diff

View File

@@ -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.0'
requires = 'plproxy, cartodb' requires = 'plproxy, cartodb'
superuser = true superuser = true
schema = cdb_dataservices_client schema = cdb_dataservices_client

View File

@@ -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' }

View File

@@ -8,4 +8,13 @@ CREATE TYPE cdb_dataservices_client.simple_route AS (
shape geometry(LineString,4326), shape geometry(LineString,4326),
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);
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);

View 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

View File

@@ -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;

View File

@@ -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;

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
comment = 'CartoDB dataservices server extension' comment = 'CartoDB dataservices server extension'
default_version = '0.17.0' default_version = '0.18.0'
requires = 'plpythonu, plproxy, postgis, cdb_geocoder' requires = 'plpythonu, plproxy, postgis, cdb_geocoder'
superuser = true superuser = true
schema = cdb_dataservices_server schema = cdb_dataservices_server

View File

@@ -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']

View File

@@ -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])

View File

@@ -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])

View File

@@ -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);
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;

View File

@@ -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']

View File

@@ -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)

View File

@@ -115,4 +115,39 @@ SELECT exists(SELECT *
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
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');

View File

@@ -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,

View File

@@ -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

View File

@@ -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['geom_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")

View File

@@ -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'])