From 5b1216c6153be2c587b368086eebf7c794d5eca5 Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Sun, 14 Feb 2021 00:16:34 +0100
Subject: [PATCH] * Fixed #123 split RkiBundeslaenderService into two Services,
 one for bundeslaender and one for landkreise * Fixed #128 add fields from csv
 to RkiLandkreiseImport * Fixed #139 refactor RkiBundeslaenderServiceDownload
 to new method scheme introduced 07.02.2021 * Fixed #140 move WhoImport to RKI
 in: rk_service_import.py * Fixed #125 implement RkiLandkreise * Fixed #126
 implement RkiBundeslaenderImport

---
 .../blueprints/ecdc/ecdc_model_import.py      | 70 +++++++++----------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/covid19/blueprints/ecdc/ecdc_model_import.py b/src/covid19/blueprints/ecdc/ecdc_model_import.py
index 3093fc8f..55109684 100644
--- a/src/covid19/blueprints/ecdc/ecdc_model_import.py
+++ b/src/covid19/blueprints/ecdc/ecdc_model_import.py
@@ -68,41 +68,41 @@ class EcdcImport(db.Model):
         my_params['my_continent_param'] = my_continent_exp
         #TODO: #107 SQLalchemy instead of SQL in: EcdcImport.get_countries_of_continent
         #TODO: #108 BUG: change to ORM ClassHierarchy in: EcdcImport.get_countries_of_continent
-        return db.session.query(
-            cls.countries_and_territories,
-            cls.geo_id,
-            cls.country_territory_code,
-            cls.pop_data_2019,
-            cls.continent_exp
-        ).group_by(
-            cls.countries_and_sterritories,
-            cls.geo_id,
-            cls.country_territory_code,
-            cls.pop_data_2019,
-            cls.continent_exp
-        ).order_by(cls.countries_and_territories.asc()).filter(
-            cls.continent_exp == my_continent
-        ).distinct().all()
-        #sql = """
-        #select distinct
-        #    countries_and_territories,
-        #    geo_id,
-        #     pop_data_2019,
-        #    continent_exp
-        #from
-        #    ecdc_import
-        #group by
-        #    countries_and_territories,
-        #    geo_id,
-        #    country_territory_code,
-        #    pop_data_2019,
-        #    continent_exp
-        #having
-        #    continent_exp = :my_continent_param
-        #order by
-        #    countries_and_territories
-        #"""
-        #return db.session.execute(sql, my_params).fetchall()
+        #return db.session.query(
+        #    cls.countries_and_territories,
+        #    cls.geo_id,
+        #    cls.country_territory_code,
+        #    cls.pop_data_2019,
+        #    cls.continent_exp
+        #).group_by(
+        #    cls.countries_and_sterritories,
+        #    cls.geo_id,
+        #    cls.country_territory_code,
+        #    cls.pop_data_2019,
+        #    cls.continent_exp
+        #).order_by(cls.countries_and_territories.asc()).filter(
+        #    cls.continent_exp == my_continent
+        #).distinct().all()
+        sql = """
+        select distinct
+            countries_and_territories,
+            geo_id,
+             pop_data_2019,
+            continent_exp
+        from
+            ecdc_import
+        group by
+            countries_and_territories,
+            geo_id,
+            country_territory_code,
+            pop_data_2019,
+            continent_exp
+        having
+            continent_exp = :my_continent_param
+        order by
+            countries_and_territories
+        """
+        return db.session.execute(sql, my_params).fetchall()
 
     @classmethod
     def find_by_date_reported(cls, europe_date_reported):
-- 
GitLab