kill obs_lookupcensushuman
This commit is contained in:
parent
c0d04c7d9b
commit
af14526734
@ -79,37 +79,6 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
--Gets the column id for a census variable given a human readable version of it
|
|
||||||
-- Old: OBS_LOOKUP_CENSUS_HUMAN
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cdb_observatory._OBS_LookupCensusHuman(
|
|
||||||
column_names text[],
|
|
||||||
-- TODO: change variable name table_name to table_id
|
|
||||||
table_name text DEFAULT 'us.census.acs.extract_block_group_5yr_2013_69b156927c'
|
|
||||||
)
|
|
||||||
RETURNS text[] as $$
|
|
||||||
DECLARE
|
|
||||||
column_id text;
|
|
||||||
result text;
|
|
||||||
BEGIN
|
|
||||||
EXECUTE format('
|
|
||||||
WITH col_names AS (
|
|
||||||
select row_number() over() as no, a.column_name as column_name from(
|
|
||||||
select unnest($1) as column_name
|
|
||||||
) a
|
|
||||||
)
|
|
||||||
select array_agg(column_id order by col_names.no)
|
|
||||||
FROM observatory.OBS_column_table,col_names
|
|
||||||
where colname = col_names.column_name
|
|
||||||
and table_id = %L limit 1
|
|
||||||
', table_name)
|
|
||||||
INTO result
|
|
||||||
using column_names;
|
|
||||||
RETURN result;
|
|
||||||
END
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
|
|
||||||
--Test point cause Stuart always seems to make random points in the water
|
--Test point cause Stuart always seems to make random points in the water
|
||||||
CREATE OR REPLACE FUNCTION cdb_observatory._TestPoint()
|
CREATE OR REPLACE FUNCTION cdb_observatory._TestPoint()
|
||||||
RETURNS geometry
|
RETURNS geometry
|
||||||
|
@ -94,27 +94,6 @@ from result;
|
|||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- OBS_LookupCensusHuman
|
|
||||||
-- should give back: {"us.census.acs.B19083001"}
|
|
||||||
SELECT
|
|
||||||
cdb_observatory._OBS_LookupCensusHuman(
|
|
||||||
Array['gini_index']
|
|
||||||
);
|
|
||||||
_obs_lookupcensushuman
|
|
||||||
---------------------------
|
|
||||||
{us.census.acs.B19083001}
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- should be empty array
|
|
||||||
SELECT
|
|
||||||
cdb_observatory._OBS_LookupCensusHuman(
|
|
||||||
Array['cookies']
|
|
||||||
);
|
|
||||||
_obs_lookupcensushuman
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- OBS_BuildSnapshotQuery
|
-- OBS_BuildSnapshotQuery
|
||||||
-- Should give back: SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
|
-- Should give back: SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -55,19 +55,6 @@ SELECT
|
|||||||
select expected is null as OBS_GetColumnData_missing_measure
|
select expected is null as OBS_GetColumnData_missing_measure
|
||||||
from result;
|
from result;
|
||||||
|
|
||||||
-- OBS_LookupCensusHuman
|
|
||||||
-- should give back: {"us.census.acs.B19083001"}
|
|
||||||
SELECT
|
|
||||||
cdb_observatory._OBS_LookupCensusHuman(
|
|
||||||
Array['gini_index']
|
|
||||||
);
|
|
||||||
|
|
||||||
-- should be empty array
|
|
||||||
SELECT
|
|
||||||
cdb_observatory._OBS_LookupCensusHuman(
|
|
||||||
Array['cookies']
|
|
||||||
);
|
|
||||||
|
|
||||||
-- OBS_BuildSnapshotQuery
|
-- OBS_BuildSnapshotQuery
|
||||||
-- Should give back: SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
|
-- Should give back: SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
|
||||||
SELECT
|
SELECT
|
||||||
|
Loading…
Reference in New Issue
Block a user