renaming output id to rowid

This commit is contained in:
Andy Eschbacher 2016-06-01 12:43:33 -04:00
parent 3013998e1b
commit 90c3e21c0d
2 changed files with 28 additions and 28 deletions

View File

@ -26,7 +26,7 @@ CREATE OR REPLACE FUNCTION
permutations INT, permutations INT,
geom_col TEXT, geom_col TEXT,
id_col TEXT) id_col TEXT)
RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()') plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()')
from crankshaft.clustering import moran_local from crankshaft.clustering import moran_local
@ -44,10 +44,10 @@ CREATE OR REPLACE FUNCTION
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col); FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col);
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
@ -62,10 +62,10 @@ CREATE OR REPLACE FUNCTION
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('HH', 'HL'); WHERE quads IN ('HH', 'HL');
@ -81,10 +81,10 @@ CREATE OR REPLACE FUNCTION
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('LL', 'LH'); WHERE quads IN ('LL', 'LH');
@ -100,10 +100,10 @@ CREATE OR REPLACE FUNCTION
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('HL', 'LH'); WHERE quads IN ('HL', 'LH');
@ -141,7 +141,7 @@ CREATE OR REPLACE FUNCTION
geom_col TEXT, geom_col TEXT,
id_col TEXT) id_col TEXT)
RETURNS RETURNS
TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()') plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()')
from crankshaft.clustering import moran_local_rate from crankshaft.clustering import moran_local_rate
@ -161,10 +161,10 @@ CREATE OR REPLACE FUNCTION
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS RETURNS
TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col); FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col);
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
@ -181,10 +181,10 @@ CREATE OR REPLACE FUNCTION
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS RETURNS
TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('HH', 'HL'); WHERE quads IN ('HH', 'HL');
@ -202,10 +202,10 @@ CREATE OR REPLACE FUNCTION
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS RETURNS
TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('LL', 'LH'); WHERE quads IN ('LL', 'LH');
@ -223,10 +223,10 @@ CREATE OR REPLACE FUNCTION
geom_col TEXT DEFAULT 'the_geom', geom_col TEXT DEFAULT 'the_geom',
id_col TEXT DEFAULT 'cartodb_id') id_col TEXT DEFAULT 'cartodb_id')
RETURNS RETURNS
TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, ids INT, y NUMERIC) TABLE(moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, y NUMERIC)
AS $$ AS $$
SELECT moran, quads, significance, ids, y SELECT moran, quads, significance, rowid, y
FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocalRate(subquery, numerator, denominator, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('HL', 'LH'); WHERE quads IN ('HL', 'LH');

View File

@ -11,7 +11,7 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints.code, m.quads SELECT ppoints.code, m.quads
FROM ppoints FROM ppoints
JOIN cdb_crankshaft.CDB_AreasOfInterestLocal('SELECT * FROM ppoints', 'value') m JOIN cdb_crankshaft.CDB_AreasOfInterestLocal('SELECT * FROM ppoints', 'value') m
ON ppoints.cartodb_id = m.ids ON ppoints.cartodb_id = m.rowid
ORDER BY ppoints.code; ORDER BY ppoints.code;
SELECT cdb_crankshaft._cdb_random_seeds(1234); SELECT cdb_crankshaft._cdb_random_seeds(1234);
@ -20,7 +20,7 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints.code, m.quads SELECT ppoints.code, m.quads
FROM ppoints FROM ppoints
JOIN cdb_crankshaft.CDB_GetSpatialHotspots('SELECT * FROM ppoints', 'value') m JOIN cdb_crankshaft.CDB_GetSpatialHotspots('SELECT * FROM ppoints', 'value') m
ON ppoints.cartodb_id = m.ids ON ppoints.cartodb_id = m.rowid
ORDER BY ppoints.code; ORDER BY ppoints.code;
SELECT cdb_crankshaft._cdb_random_seeds(1234); SELECT cdb_crankshaft._cdb_random_seeds(1234);
@ -29,7 +29,7 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints.code, m.quads SELECT ppoints.code, m.quads
FROM ppoints FROM ppoints
JOIN cdb_crankshaft.CDB_GetSpatialColdspots('SELECT * FROM ppoints', 'value') m JOIN cdb_crankshaft.CDB_GetSpatialColdspots('SELECT * FROM ppoints', 'value') m
ON ppoints.cartodb_id = m.ids ON ppoints.cartodb_id = m.rowid
ORDER BY ppoints.code; ORDER BY ppoints.code;
SELECT cdb_crankshaft._cdb_random_seeds(1234); SELECT cdb_crankshaft._cdb_random_seeds(1234);
@ -38,7 +38,7 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints.code, m.quads SELECT ppoints.code, m.quads
FROM ppoints FROM ppoints
JOIN cdb_crankshaft.CDB_GetSpatialOutliers('SELECT * FROM ppoints', 'value') m JOIN cdb_crankshaft.CDB_GetSpatialOutliers('SELECT * FROM ppoints', 'value') m
ON ppoints.cartodb_id = m.ids ON ppoints.cartodb_id = m.rowid
ORDER BY ppoints.code; ORDER BY ppoints.code;
@ -48,16 +48,16 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints2.code, m.quads SELECT ppoints2.code, m.quads
FROM ppoints2 FROM ppoints2
JOIN cdb_crankshaft.CDB_AreasOfInterestLocalRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m JOIN cdb_crankshaft.CDB_AreasOfInterestLocalRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m
ON ppoints2.cartodb_id = m.ids ON ppoints2.cartodb_id = m.rowid
ORDER BY ppoints2.code; ORDER BY ppoints2.code;
SELECT cdb_crankshaft._cdb_random_seeds(1234); SELECT cdb_crankshaft._cdb_random_seeds(1234);
-- Spatial Hotspots (rate) -- Spatial Hotspots (rate)
SELECT ppoints2.code, m.quads SELECT ppoints2.code, m.quads
FROM ppoints2 FROM ppoints2
JOIN cdb_crankshaft.CDB_GetSpatialHotspotsRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m JOIN cdb_crankshaft.CDB_GetSpatialHotspotsRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m
ON ppoints2.cartodb_id = m.ids ON ppoints2.cartodb_id = m.rowid
ORDER BY ppoints2.code; ORDER BY ppoints2.code;
SELECT cdb_crankshaft._cdb_random_seeds(1234); SELECT cdb_crankshaft._cdb_random_seeds(1234);
@ -66,7 +66,7 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints2.code, m.quads SELECT ppoints2.code, m.quads
FROM ppoints2 FROM ppoints2
JOIN cdb_crankshaft.CDB_GetSpatialColdspotsRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m JOIN cdb_crankshaft.CDB_GetSpatialColdspotsRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m
ON ppoints2.cartodb_id = m.ids ON ppoints2.cartodb_id = m.rowid
ORDER BY ppoints2.code; ORDER BY ppoints2.code;
SELECT cdb_crankshaft._cdb_random_seeds(1234); SELECT cdb_crankshaft._cdb_random_seeds(1234);
@ -75,5 +75,5 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT ppoints2.code, m.quads SELECT ppoints2.code, m.quads
FROM ppoints2 FROM ppoints2
JOIN cdb_crankshaft.CDB_GetSpatialOutliersRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m JOIN cdb_crankshaft.CDB_GetSpatialOutliersRate('SELECT * FROM ppoints2', 'numerator', 'denominator') m
ON ppoints2.cartodb_id = m.ids ON ppoints2.cartodb_id = m.rowid
ORDER BY ppoints2.code; ORDER BY ppoints2.code;