diff --git a/Dockerfiles/python/scripts/main.py b/Dockerfiles/python/scripts/main.py index 8e3febb82b6c07a631fea7256fca67195c2734c2..d22d078ae0b38b9d0c6890377807e06c07d63ef9 100644 --- a/Dockerfiles/python/scripts/main.py +++ b/Dockerfiles/python/scripts/main.py @@ -652,8 +652,8 @@ def computeFactors(inseeCode=None): # queryFactorAndInsee = "SELECT count(*) FROM base.tiles_factors tf INNER JOIN base.tiles t ON tf.id_tile = t.id AND t.insee = '{}' WHERE id_factor = {};".format(inseeCode, currFactorID) # currTFDataFAI = getDatafromDB(DB_params, queryFactorAndInsee) - currTFDataFAI = getProgress(cur, DB_schema, inseeCode, currFactorID) - currTFDataCount = json.loads(currTFDataFAI)[0]['count'] + currTFDataCount = getProgress(cur, DB_schema, inseeCode, currFactorID) + # currTFDataCount = json.loads(currTFDataFAI)[0]['count'] # if inseeCode: # # Check TILES_FACTORS existing data (with insee) diff --git a/Dockerfiles/python/scripts/utils.py b/Dockerfiles/python/scripts/utils.py index bf8658844619d4e232f98f789f5a44de32b1eb62..242f26417b41896b943ba6d910bf89629db7d6af 100644 --- a/Dockerfiles/python/scripts/utils.py +++ b/Dockerfiles/python/scripts/utils.py @@ -827,8 +827,8 @@ def setProgress(DBcursor, DBSchema, codeInsee, id_factor=None): qryFilter = ' and id_factor = ' + id_factor insertComplement = ', ' + id_factor # Ensure there is only one occurence for the township - DBcursor.execute('DELETE FROM ' + DBSchema + '.' + stage + '_progress WHERE codeInsee = ' + codeInsee + qryFilter) - insertDataInDB(DBcursor,'INSERT INTO ' + stage + '_progress VALUES (' + codeInsee + insertComplement + ')') + DBcursor.execute('DELETE FROM ' + DBSchema + '.' + stage + '_progress WHERE insee = ' + codeInsee + qryFilter) + insertDataInDB(DBcursor,'INSERT INTO ' + DBSchema + '.' + stage + '_progress VALUES (' + codeInsee + insertComplement + ')') def getProgress(DBcursor, DBSchema, codeInsee, id_factor=None): stage = 'tiles' @@ -837,5 +837,5 @@ def getProgress(DBcursor, DBSchema, codeInsee, id_factor=None): stage = 'factors' qryFilter = ' and id_factor = ' + id_factor DBcursor.execute('SELECT count(1) FROM '+ DBSchema + '.' + stage + '_progress WHERE insee = ' + codeInsee + qryFilter) - dataValues = json.dumps(DBcursor.fetchall(), indent=2, default=dateConverter) + dataValues = json.loads(json.dumps(DBcursor.fetchall(), indent=2, default=dateConverter))[0][0] return dataValues