Open antoniocarlon opened 6 years ago
Currently if we query OBS_GetData to get info from a given numerator and the denominator is in a different table the functions raises an error:
ERROR: missing FROM-clause entry for table "obs_d1950a243d677b546ad0f1ee3db06ab1e9880067"
We need to allow numerators and denominators to be in different tables.
Example query:
SELECT * FROM cdb_observatory.OBS_GetData(ARRAY[(ST_Transform(ST_Buffer(ST_Transform(ST_SetSRID(ST_MakePoint(-79.37965393066406, 43.65594991256823), 4326), 3857), 250), 4326), 1)::geomval], '[ {"geom_geomref_colname": "geom_id", "timespan_rownum": 1, "max_score_rank": null, "numer_aggregate": "average", "target_geoms": null, "denom_type": "Numeric", "geom_name": "Census Tracts", "timespan_rank": 1, "numer_description": null, "denom_tablename": "obs_d1950a243d677b546ad0f1ee3db06ab1e9880067", "denom_description": null, "geom_timespan": "2011", "numer_type": "Numeric", "geom_tablename": "obs_c39a7f544c336527eafd0ec4e3997cf2e0cf4f7f", "denom_t_description": null, "geom_id": "ca.statcan.geo.ct_", "numer_t_description": null, "geom_type": "Geometry", "denom_name": "Total labour force aged 15 years and over (female)", "target_area": null, "denom_geomref_colname": "geo_code", "denom_aggregate": "sum", "numer_id": "ca.statcan.cols_nhs.t029c009_f", "denom_reltype": "universe", "numer_name": "Average weeks worked in 2010 (female)", "numer_tablename": "obs_58e761d4d87e38bd23119580bb20caa836d17bad", "max_timespan_rank": null, "numer_timespan": "2011", "score": 9.547823920507708, "normalization": "predenominated", "numer_geomref_colname": "geo_code", "numer_colname": "t029c009_f", "geom_colname": "the_geom", "num_geoms": 0.0274045324333905, "score_rank": 1, "geom_description": "", "denom_id": "ca.statcan.cols_nhs.t004c001_f", "geom_t_description": null, "score_rownum": 1, "suggested_name": "t029c009_f_2011", "denom_colname": "t004c001_f", "id": 10}]')
Currently if we query OBS_GetData to get info from a given numerator and the denominator is in a different table the functions raises an error:
We need to allow numerators and denominators to be in different tables.
Example query: