diff --git a/API/hdx.py b/API/hdx.py index 33276946..b5d89a20 100644 --- a/API/hdx.py +++ b/API/hdx.py @@ -63,8 +63,10 @@ async def read_hdx_list( filters[f"{key} = %s"] = values continue filters[f"dataset->>'{key}' = %s"] = values - - hdx_list = hdx_instance.get_hdx_list_with_filters(skip, limit, filters) + try: + hdx_list = hdx_instance.get_hdx_list_with_filters(skip, limit, filters) + except Exception as ex: + raise HTTPException(status_code=422, detail="Couldn't process query") return hdx_list diff --git a/src/app.py b/src/app.py index 7e3026e4..5d817458 100644 --- a/src/app.py +++ b/src/app.py @@ -1970,7 +1970,9 @@ def get_hdx_list_with_filters( OFFSET %s LIMIT %s """ ) + self.cur.execute(select_query, tuple(filter_values) + (skip, limit)) + result = self.cur.fetchall() self.d_b.close_conn() return [orjson.loads(item[0]) for item in result]