1 from .meteofrance import MeteoFrance
3 from extomeAI.lib.connector import PostgreSQLDBConnection
5 from csv import DictReader
6 from logging.config import fileConfig
7 from pathlib import Path
11 fileConfig((Path.cwd() / 'config') / 'logging.cfg')
12 logger = logging.getLogger()
14 with PostgreSQLDBConnection.Instance() as db:
15 db.cursor.execute('SELECT count(*) FROM "PARAMETER";')
16 nb_parameters = db.cursor.fetchone()[0]
18 logger.info('Inserting PARAMETER values from parameters.csv')
19 csv_file = Path.cwd() / 'config' / 'features' / 'parameters.csv'
20 with open(csv_file, "r") as f:
21 reader = DictReader(f, delimiter=',')
23 request = f"""INSERT INTO "PARAMETER" ("PARAM_NAME")
24 VALUES ('{row['PARAM_NAME']}');"""
25 db.cursor.execute(request)