Skip to content

Commit

Permalink
Enhance query speed for single features
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Jan 12, 2024
1 parent 5ece744 commit b561e33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/query_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}") """

Expand Down

0 comments on commit b561e33

Please sign in to comment.