From b561e33e2e1a53db362548332de1514188e0f200 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Fri, 12 Jan 2024 13:47:09 +0545 Subject: [PATCH] Enhance query speed for single features --- src/query_builder/builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/query_builder/builder.py b/src/query_builder/builder.py index b92a79b7..4625296d 100644 --- a/src/query_builder/builder.py +++ b/src/query_builder/builder.py @@ -901,10 +901,10 @@ def convert_tags_pattern(query_string): if cid else f"""ST_within(geom,(select ST_SetSRID(ST_Extent(ST_makeValid(ST_GeomFromText('{wkt.dumps(loads(geometry.json()),decimals=6)}',4326))),4326)))""" ) - if single_category_where: - row_filter_condition += f" and ({convert_tags_pattern(single_category_where)})" - + postgres_query = f"""select {select_query} from (select * , tableoid::regclass as osm_type from {table} where {row_filter_condition}) as sub_query""" + if single_category_where: + postgres_query += f" where {convert_tags_pattern(single_category_where)}" duck_db_create = f"""CREATE TABLE {base_table_name}_{table} AS SELECT {create_select_duck_db} FROM postgres_query("postgres_db", "{postgres_query}") """