From 3299bb013b1778def962acfed82040fc1d527f1b Mon Sep 17 00:00:00 2001 From: John Krauss Date: Thu, 5 May 2016 11:46:04 -0400 Subject: [PATCH] kill obs_lookupcensushuman --- src/pg/sql/40_observatory_utility.sql | 31 ------------------- .../expected/40_observatory_utility_test.out | 21 ------------- .../test/sql/40_observatory_utility_test.sql | 13 -------- 3 files changed, 65 deletions(-) diff --git a/src/pg/sql/40_observatory_utility.sql b/src/pg/sql/40_observatory_utility.sql index 17dd50d..cb5611d 100644 --- a/src/pg/sql/40_observatory_utility.sql +++ b/src/pg/sql/40_observatory_utility.sql @@ -79,37 +79,6 @@ BEGIN END; $$ 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 CREATE OR REPLACE FUNCTION cdb_observatory._TestPoint() RETURNS geometry diff --git a/src/pg/test/expected/40_observatory_utility_test.out b/src/pg/test/expected/40_observatory_utility_test.out index 93beccc..2895652 100644 --- a/src/pg/test/expected/40_observatory_utility_test.out +++ b/src/pg/test/expected/40_observatory_utility_test.out @@ -94,27 +94,6 @@ from result; t (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 -- 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 diff --git a/src/pg/test/sql/40_observatory_utility_test.sql b/src/pg/test/sql/40_observatory_utility_test.sql index 3410336..2fe41bd 100644 --- a/src/pg/test/sql/40_observatory_utility_test.sql +++ b/src/pg/test/sql/40_observatory_utility_test.sql @@ -55,19 +55,6 @@ SELECT select expected is null as OBS_GetColumnData_missing_measure 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 -- 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