@@ -218,8 +218,7 @@ def _thing_collections_block(
218218 blocks = []
219219 for collection in THING_COLLECTIONS :
220220 keywords = ", " .join (collection ["keywords" ])
221- blocks .append (
222- f""" { collection ["id" ]} :
221+ blocks .append (f""" { collection ["id" ]} :
223222 type: collection
224223 title: { collection ["title" ]}
225224 description: { collection ["description" ]}
@@ -240,8 +239,7 @@ def _thing_collections_block(
240239 search_path: [public]
241240 id_field: id
242241 table: ogc_{ collection ["id" ]}
243- geom_field: point"""
244- )
242+ geom_field: point""" )
245243 return "\n \n " .join (blocks )
246244
247245
@@ -347,9 +345,7 @@ def _create_supporting_views() -> None:
347345 for collection in THING_COLLECTIONS :
348346 session .execute (text (f'DROP VIEW IF EXISTS ogc_{ collection ["id" ]} ' ))
349347 thing_type = collection ["thing_type" ].replace ("'" , "''" )
350- session .execute (
351- text (
352- f"""
348+ session .execute (text (f"""
353349 CREATE OR REPLACE VIEW ogc_{ collection ["id" ]} AS
354350 WITH latest_location AS (
355351 SELECT DISTINCT ON (lta.thing_id)
@@ -384,14 +380,10 @@ def _create_supporting_views() -> None:
384380 JOIN latest_location AS ll ON ll.thing_id = t.id
385381 JOIN location AS l ON l.id = ll.location_id
386382 WHERE t.thing_type = '{ thing_type } '
387- """
388- )
389- )
383+ """ ))
390384 if _required_depth_tables_exist ():
391385 session .execute (text ("DROP VIEW IF EXISTS ogc_latest_depth_to_water_wells" ))
392- session .execute (
393- text (
394- """
386+ session .execute (text ("""
395387 CREATE OR REPLACE VIEW ogc_latest_depth_to_water_wells AS
396388 WITH latest_location AS (
397389 SELECT DISTINCT ON (lta.thing_id)
@@ -440,14 +432,10 @@ def _create_supporting_views() -> None:
440432 JOIN latest_location AS ll ON ll.thing_id = t.id
441433 JOIN location AS l ON l.id = ll.location_id
442434 WHERE ro.rn = 1
443- """
444- )
445- )
435+ """ ))
446436 else :
447437 session .execute (text ("DROP VIEW IF EXISTS ogc_latest_depth_to_water_wells" ))
448- session .execute (
449- text (
450- """
438+ session .execute (text ("""
451439 CREATE OR REPLACE VIEW ogc_latest_depth_to_water_wells AS
452440 SELECT
453441 t.id AS id,
@@ -463,14 +451,10 @@ def _create_supporting_views() -> None:
463451 JOIN location_thing_association AS lta ON lta.thing_id = t.id
464452 JOIN location AS l ON l.id = lta.location_id
465453 WHERE FALSE
466- """
467- )
468- )
454+ """ ))
469455 if _required_tds_tables_exist ():
470456 session .execute (text ("DROP VIEW IF EXISTS ogc_avg_tds_wells" ))
471- session .execute (
472- text (
473- """
457+ session .execute (text ("""
474458 CREATE OR REPLACE VIEW ogc_avg_tds_wells AS
475459 WITH latest_location AS (
476460 SELECT DISTINCT ON (lta.thing_id)
@@ -517,14 +501,10 @@ def _create_supporting_views() -> None:
517501 JOIN latest_location AS ll ON ll.thing_id = t.id
518502 JOIN location AS l ON l.id = ll.location_id
519503 GROUP BY t.id, t.name, t.thing_type, l.point
520- """
521- )
522- )
504+ """ ))
523505 else :
524506 session .execute (text ("DROP VIEW IF EXISTS ogc_avg_tds_wells" ))
525- session .execute (
526- text (
527- """
507+ session .execute (text ("""
528508 CREATE OR REPLACE VIEW ogc_avg_tds_wells AS
529509 SELECT
530510 t.id AS id,
@@ -539,9 +519,7 @@ def _create_supporting_views() -> None:
539519 JOIN location_thing_association AS lta ON lta.thing_id = t.id
540520 JOIN location AS l ON l.id = lta.location_id
541521 WHERE FALSE
542- """
543- )
544- )
522+ """ ))
545523 session .commit ()
546524
547525
0 commit comments