From a77314db3cde92d15fb2ec8f23f8dbd0cdd28d59 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Sun, 25 Apr 2021 22:43:33 +0200 Subject: [PATCH] working on 0.0.31 Release * ------------------------------------- * Fixed #211 ECDC-templates: change URL to for_url() * Fixed #213 WHO-template: change URL to for_url() * ------------------------------------- * Issue #195 RkiVaccinationImport.get_daterep_missing_in_vaccination_data(): native SQL to SQLalechemy Query * Fixed #83 WhoImport.get_new_dates_as_array() SQLalchemy instead of SQL * Fixed #219 WhoImport.countries() SQLalchemy instead of SQL * ------------------------------------- * Issue #207 remove deprecated: database.port * Issue #208 remove deprecated: database.run_run_with_debug * Issue #209 remove deprecated: database.ITEMS_PER_PAGE * ------------------------------------- * Issue #210 database.py: logging for Celery on Windows * ------------------------------------- * Fixed #196 OwidImport.get_new_dates_reported_as_array() needs implementation * ------------------------------------- * Issue #212 implement OwidService.task_database_drop_create() * ------------------------------------- * Issue #214 implement OwidServiceUpdate.update_dimension_tables_only() * Issue #215 implement OwidServiceUpdate.update_fact_table_incremental_only() * Issue #216 implement OwidServiceUpdate.update_fact_table_initial_only() * Issue #217 implement OwidServiceUpdate.update_star_schema_incremental() * Issue #218 implement OwidServiceUpdate.update_star_schema_initial() * ------------------------------------- --- src/covid19/blueprints/owid/owid_model.py | 10 ++++++---- src/covid19/blueprints/owid_test/owid_test_service.py | 2 +- src/covid19/blueprints/who/who_model.py | 2 +- src/covid19/blueprints/who_test/who_test_service.py | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/covid19/blueprints/owid/owid_model.py b/src/covid19/blueprints/owid/owid_model.py index bdd53640..e9b03ad3 100644 --- a/src/covid19/blueprints/owid/owid_model.py +++ b/src/covid19/blueprints/owid/owid_model.py @@ -1,7 +1,9 @@ from sqlalchemy import and_, func from datetime import date +from sqlalchemy.orm import joinedload, load_only, defaultload, defer, undefer, query_expression, subqueryload +from sqlalchemy.sql import select + from database import db, ITEMS_PER_PAGE -from sqlalchemy.orm import joinedload from covid19.blueprints.application.application_model import ApplicationDateReported, ApplicationRegion @@ -279,6 +281,6 @@ class OwidData(db.Model): @classmethod def delete_data_for_one_day(cls, date_reported): - for data in cls.get_data_for_one_day(): - db.session.remove(data) - db.session.commit() + for data in cls.get_data_for_one_day(date_reported): + db.session.delete(data) + db.session.commit() diff --git a/src/covid19/blueprints/owid_test/owid_test_service.py b/src/covid19/blueprints/owid_test/owid_test_service.py index 4f9b847b..7233e05d 100644 --- a/src/covid19/blueprints/owid_test/owid_test_service.py +++ b/src/covid19/blueprints/owid_test/owid_test_service.py @@ -31,7 +31,7 @@ class OwidTestService: i = 0 for data in OwidData.get_data_for_one_day(joungest_datum): i += 1 - line = " | " + str(i) + " | " + str(data.date_reported) + " | " + data.country.country + " | to be deleted" + line = " | " + str(i) + " | " + str(data.date_reported) + " | " + data.country.location + " | to be deleted" app.logger.info(line) app.logger.info("WhoData.delete_data_for_one_day(joungest_datum)") OwidData.delete_data_for_one_day(joungest_datum) diff --git a/src/covid19/blueprints/who/who_model.py b/src/covid19/blueprints/who/who_model.py index 12e0817b..dac88da0 100644 --- a/src/covid19/blueprints/who/who_model.py +++ b/src/covid19/blueprints/who/who_model.py @@ -1,8 +1,8 @@ from sqlalchemy import and_, func from datetime import date -from database import db, ITEMS_PER_PAGE from sqlalchemy.orm import joinedload, load_only, defaultload, defer, undefer, query_expression, subqueryload from sqlalchemy.sql import select +from database import db, ITEMS_PER_PAGE from covid19.blueprints.application.application_model import ApplicationDateReported, ApplicationRegion diff --git a/src/covid19/blueprints/who_test/who_test_service.py b/src/covid19/blueprints/who_test/who_test_service.py index d976957d..ac7b0e72 100644 --- a/src/covid19/blueprints/who_test/who_test_service.py +++ b/src/covid19/blueprints/who_test/who_test_service.py @@ -24,9 +24,9 @@ class WhoTestService: app.logger.info(joungest_datum) app.logger.info("WhoData.get_data_for_one_day(joungest_datum):") i = 0 - for who_data in WhoData.get_data_for_one_day(joungest_datum): + for data in WhoData.get_data_for_one_day(joungest_datum): i += 1 - line = " | " + str(i) + " | " + str(who_data.date_reported) + " | " + who_data.country.country + " | to be deleted" + line = " | " + str(i) + " | " + str(data.date_reported) + " | " + data.country.country + " | to be deleted" app.logger.info(line) app.logger.info("WhoData.delete_data_for_one_day(joungest_datum)") WhoData.delete_data_for_one_day(joungest_datum) -- GitLab