X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/predictops.git/blobdiff_plain/844b558b71ac568d904e8845ce203d31b68c776d..dc10b29095dc3e2d74b82b208fd4f4677e6a9c30:/lib/source/__init__.py?ds=sidebyside diff --git a/lib/source/__init__.py b/lib/source/__init__.py index d2c2a0f..527538d 100644 --- a/lib/source/__init__.py +++ b/lib/source/__init__.py @@ -1,25 +1 @@ -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) +from .meteofrance import MeteoFrance \ No newline at end of file