diff --git a/view/create_views.py b/view/create_views.py index 813481581..933ba80d7 100755 --- a/view/create_views.py +++ b/view/create_views.py @@ -87,10 +87,11 @@ def create_views(srid: int, cursr = connctn.cursor() plantype_row_sql= "SELECT * from qgep_vl.wastewater_structure_symbol_plantype" cursr.execute(plantype_row_sql) - for plantype_row in cursr.fetchall() - vw_qgep_ws_symbol_plantype(srid=srid, pg_service=pg_service, extra_definition=extra_definition, plantype_row=plantype_row) - cursr.close() + rows = cursr.fetchall(); + cursr.close() connctn.close() + for plantype_row in rows: + vw_qgep_ws_symbol_plantype(srid=srid, pg_service=pg_service, extra_definition=extra_definition, plantype_row=plantype_row) run_sql('view/vw_file.sql', pg_service, variables) diff --git a/view/vw_qgep_ws_plantype.py b/view/vw_qgep_ws_plantype.py index b2de04b5e..bf2cb7e9d 100644 --- a/view/vw_qgep_ws_plantype.py +++ b/view/vw_qgep_ws_plantype.py @@ -547,11 +547,13 @@ def vw_qgep_ws_symbol_plantype(srid: int, srid = args.srid or os.getenv('SRID') pg_service = args.pg_service or os.getenv('PGSERVICE') extra_definition = safe_load(open(args.extra_definition)) if args.extra_definition else {} + # symbol views connctn = psycopg2.connect("service={0}".format(pg_service)) cursr = connctn.cursor() plantype_row_sql= "SELECT * from qgep_vl.wastewater_structure_symbol_plantype" cursr.execute(plantype_row_sql) - for plantype_row in cursr.fetchall() - vw_qgep_ws_symbol_plantype(srid=srid, pg_service=pg_service, extra_definition=extra_definition, plantype_row=plantype_row) - cursr.close() + rows = cursr.fetchall(); + cursr.close() connctn.close() + for plantype_row in rows: + vw_qgep_ws_symbol_plantype(srid=srid, pg_service=pg_service, extra_definition=extra_definition, plantype_row=plantype_row)