1503b5bb2b
- Server extension version 0.25.0 - Client extension version 0.18.0 - Python library version 0.15.2
41 lines
2.8 KiB
PL/PgSQL
41 lines
2.8 KiB
PL/PgSQL
--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.24.2'" to load this file. \quit
|
|
|
|
-- HERE goes your code to upgrade/downgrade
|
|
---- cdb_geocode_namedplace_point(city_name text)
|
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text)
|
|
RETURNS Geometry AS $$
|
|
import spiexceptions
|
|
try:
|
|
mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"])
|
|
return plpy.execute(mapzen_plan, [username, orgname, city_name])[0]['point']
|
|
except spiexceptions.ExternalRoutineException as e:
|
|
internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3) as point;", ["text", "text", "text"])
|
|
return plpy.execute(internal_plan, [username, orgname, city_name])[0]['point']
|
|
$$ LANGUAGE plpythonu;
|
|
|
|
---- cdb_geocode_namedplace_point(city_name text, country_name text)
|
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text)
|
|
RETURNS Geometry AS $$
|
|
import spiexceptions
|
|
try:
|
|
mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"])
|
|
return plpy.execute(mapzen_plan, [username, orgname, city_name, country_name])[0]['point']
|
|
except spiexceptions.ExternalRoutineException as e:
|
|
internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, NULL, $4) as point;", ["text", "text", "text", "text"])
|
|
return plpy.execute(internal_plan, [username, orgname, city_name, country_name])[0]['point']
|
|
$$ LANGUAGE plpythonu;
|
|
|
|
---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text)
|
|
RETURNS Geometry AS $$
|
|
import spiexceptions
|
|
try:
|
|
mapzen_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_mapzen_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"])
|
|
return plpy.execute(mapzen_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point']
|
|
except spiexceptions.ExternalRoutineException as e:
|
|
internal_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_internal_geocode_namedplace($1, $2, $3, $4, $5) as point;", ["text", "text", "text", "text", "text"])
|
|
return plpy.execute(internal_plan, [username, orgname, city_name, admin1_name, country_name])[0]['point']
|
|
$$ LANGUAGE plpythonu;
|