11from sqlalchemy import func
2- from sqlalchemy .sql import text , case
2+ from sqlalchemy .sql import case
33from sqlalchemy .sql .sqltypes import String
44from sqlalchemy .future import select
55from sqlalchemy .sql .expression import cast
@@ -59,19 +59,19 @@ async def get_parcel_meta_by_lat_lng(
5959 MunicipalityKey .municipality_key .label ('municipality_number' ),
6060 parcel_number_case ,
6161 area_hectares ,
62- geojson ,
62+ geojson
6363 )
6464 .join (
6565 MunicipalityKey ,
6666 MunicipalityKey .municipality_key == func .LPAD (
6767 cast (Flurstueck .gmdschl , String ), 8 , '0'
68- ),
68+ )
6969 )
7070 .join (
7171 DistrictNumber ,
7272 DistrictNumber .district_number == func .LPAD (
7373 cast (Flurstueck .kreisschl , String ), 5 , '0'
74- ),
74+ )
7575 )
7676 .where (func .ST_Contains (Flurstueck .geometrie , point ))
7777 )
@@ -178,19 +178,19 @@ async def get_municipality_by_query(
178178 region_name_case = case (
179179 (VG25Gem .ibz != 60 , func .concat (VG25Krs .bez , ' ' , VG25Krs .gen )),
180180 else_ = VG25Lan .gen
181- ).label (" region_name" )
181+ ).label (' region_name' )
182182
183183 stmt = (
184184 select (
185- VG25Gem .ags .label (" municipality_key" ),
186- VG25Gem .gen .label (" geographical_name" ),
185+ VG25Gem .ags .label (' municipality_key' ),
186+ VG25Gem .gen .label (' geographical_name' ),
187187 region_name_case ,
188188 func .jsonb_build_object (
189189 'xmin' , func .ST_XMin (VG25Gem .geom ),
190190 'ymin' , func .ST_YMin (VG25Gem .geom ),
191191 'xmax' , func .ST_XMax (VG25Gem .geom ),
192192 'ymax' , func .ST_YMax (VG25Gem .geom )
193- ).label (" bbox" ),
193+ ).label (' bbox' )
194194 )
195195 .select_from (VG25Gem )
196196 .join (
@@ -206,15 +206,15 @@ async def get_municipality_by_query(
206206 .where (
207207 (
208208 func .lower (VG25Gem .gen ).op ('%' )(sanitized_query ) |
209- func .lower (VG25Gem .gen ).ilike (f" %{ sanitized_query } %" )
209+ func .lower (VG25Gem .gen ).ilike (f' %{ sanitized_query } %' )
210210 ) &
211211 (VG25Gem .gf == 9 ) &
212212 (VG25Krs .gf == 9 ) &
213213 (VG25Lan .gf == 9 )
214214 )
215215 .order_by (
216- func .lower (VG25Gem .gen ).ilike (f" { sanitized_query } %" ).desc (),
217- func .lower (VG25Gem .gen ).ilike (f" %{ sanitized_query } %" ).desc (),
216+ func .lower (VG25Gem .gen ).ilike (f' { sanitized_query } %' ).desc (),
217+ func .lower (VG25Gem .gen ).ilike (f' %{ sanitized_query } %' ).desc (),
218218 func .similarity (func .lower (VG25Gem .gen ), sanitized_query ).desc ()
219219 )
220220 .limit (10 )
0 commit comments