From 53f0626d909865c2ff155912a027c371f264b571 Mon Sep 17 00:00:00 2001 From: Julien Corny Date: Sun, 15 Dec 2024 09:08:34 +0100 Subject: [PATCH] simplified sqlalchemy request --- backend/gn_module_zh/model/zh.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/gn_module_zh/model/zh.py b/backend/gn_module_zh/model/zh.py index 44182781..faa395f9 100644 --- a/backend/gn_module_zh/model/zh.py +++ b/backend/gn_module_zh/model/zh.py @@ -256,12 +256,11 @@ def get_regions(self, query): if municipality.LiMunicipalities.insee_reg not in region_list: region_list.append(municipality.LiMunicipalities.insee_reg) q_region = DB.session.scalars( - select(LAreas) - .select_from(LAreas, BibAreasTypes) + select(LAreas, BibAreasTypes) .where( - and_(LAreas.area_code.in_(region_list)), + and_(LAreas.area_code.in_(region_list), LAreas.id_type == BibAreasTypes.id_type, - BibAreasTypes.type_name == "RĂ©gions", + BibAreasTypes.type_name == "RĂ©gions") ) ).all() regions = [region.area_name for region in q_region]