-from .meteofrance import MeteoFrance
-
-from extomeAI.lib.connector import PostgreSQLDBConnection
-
-from csv import DictReader
-from logging.config import fileConfig
-from pathlib import Path
-
-import logging
-
-fileConfig((Path.cwd() / 'config') / 'logging.cfg')
-logger = logging.getLogger()
-
-with PostgreSQLDBConnection.Instance() as db:
- db.cursor.execute('SELECT count(*) FROM "PARAMETER";')
- nb_parameters = db.cursor.fetchone()[0]
- if not nb_parameters:
- logger.info('Inserting PARAMETER values from parameters.csv')
- csv_file = Path.cwd() / 'config' / 'features' / 'parameters.csv'
- with open(csv_file, "r") as f:
- reader = DictReader(f, delimiter=',')
- for row in reader:
- request = f"""INSERT INTO "PARAMETER" ("PARAM_NAME")
- VALUES ('{row['PARAM_NAME']}');"""
- db.cursor.execute(request)