From 25f4dbc416b019fca7b706c212eeb6a8ff2a7739 Mon Sep 17 00:00:00 2001 From: John Krauss Date: Thu, 14 Jul 2016 09:11:02 -0400 Subject: [PATCH] use obs_meta for tests --- scripts/autotest.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/autotest.py b/scripts/autotest.py index b1bc351..7f0924d 100644 --- a/scripts/autotest.py +++ b/scripts/autotest.py @@ -24,17 +24,18 @@ def query(q, is_meta=False, **options): params['api_key'] = META_API_KEY if is_meta else API_KEY return requests.get(url, params=params) -MEASURE_COLUMNS = [(r['id'], r['point_only'], ) for r in query(''' -SELECT id, aggregate NOT ILIKE 'sum' as point_only -FROM obs_column -WHERE type ILIKE 'numeric' -AND weight > 0 +MEASURE_COLUMNS = [(r['numer_id'], r['point_only'], ) for r in query(''' +SELECT distinct numer_id, numer_aggregate NOT ILIKE 'sum' as point_only +FROM obs_meta +WHERE numer_type ILIKE 'numeric' +AND numer_weight > 0 ''', is_meta=True).json()['rows']] -CATEGORY_COLUMNS = [(r['id'], ) for r in query(''' -SELECT id FROM obs_column -WHERE type ILIKE 'text' -AND weight > 0 +CATEGORY_COLUMNS = [(r['numer_id'], ) for r in query(''' +SELECT distinct numer_id +FROM obs_meta +WHERE numer_type ILIKE 'text' +AND numer_weight > 0 ''', is_meta=True).json()['rows']] BOUNDARY_COLUMNS = [(r['id'], ) for r in query(''' @@ -43,12 +44,12 @@ WHERE type ILIKE 'geometry' AND weight > 0 ''', is_meta=True).json()['rows']] -US_CENSUS_MEASURE_COLUMNS = [(r['name'], ) for r in query(''' -SELECT c.name FROM obs_column c, obs_column_tag ct -WHERE type ILIKE 'numeric' -AND c.id = ct.column_id -AND ct.tag_id LIKE 'us.census%' -AND weight > 0 +US_CENSUS_MEASURE_COLUMNS = [(r['numer_name'], ) for r in query(''' +SELECT distinct numer_name +FROM obs_meta +WHERE numer_type ILIKE 'numeric' +AND 'us.census.acs.acs' = ANY (subsection_tags) +AND numer_weight > 0 ''', is_meta=True).json()['rows']]