Skip to content
Snippets Groups Projects
Commit 5a028e01 authored by thomaswoehlke's avatar thomaswoehlke
Browse files

### 0.0.9 Release

* Fixed #18 /europe/update: Download
* Fixed #19 /europe/update: Import File to DB
* Issue #20 /europe/update: Update DB
* Issue #21 update_date_reported
* Issue #22 update_continent
* Issue #23 update_country
* Issue #24 update_data
* Issue #3 ORM: 3NF for ecdc_europa_data_import
* Issue #4 data update for 3NF ecdc_europa_data_import
parent 7564a46c
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,11 @@ class EuropeDataImportTable(db.Model):
sql = "select distinct date_rep, year_week from europe_data_import order by year_week desc"
return db.session.execute(sql)
@classmethod
def get_continent(cls):
sql = "select distinct continent_exp from europe_data_import order by continent_exp asc"
return db.session.execute(sql)
class EuropeDateReported(db.Model):
__tablename__ = 'europe_date_reported'
......
import os
import psycopg2
from database import db, app
from org.woehlke.covid19.europe.europe_model import EuropeDataImportTable, EuropeDateReported
from org.woehlke.covid19.europe.europe_model import EuropeDataImportTable, EuropeDateReported, EuropeContinent
class EuropeServiceUpdate:
......@@ -26,7 +26,7 @@ class EuropeServiceUpdate:
for result_item in result_date_rep:
my_date_rep = result_item['date_rep']
my_year_week = result_item['year_week']
app.logger.info("| "+my_date_rep+" | "+my_year_week+" |")
app.logger.info("| " + my_date_rep + " | " + my_year_week + " |")
o = EuropeDateReported(
date_rep=my_date_rep,
year_week=my_year_week
......@@ -40,7 +40,16 @@ class EuropeServiceUpdate:
def __update_continent(self):
app.logger.info(" __update_continent [begin]")
app.logger.info("------------------------------------------------------------")
app.logger.info(" ... ")
EuropeContinent.remove_all()
result_continent = EuropeDataImportTable.get_continent()
for result_item in result_continent:
my_continent_exp = result_item['continent_exp']
app.logger.info("| " + my_continent_exp + " |")
o = EuropeContinent(
continent_exp=my_continent_exp
)
db.session.add(o)
db.session.commit()
app.logger.info(" __update_continent [done]")
app.logger.info("------------------------------------------------------------")
return self
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment