if rdc == True: sql = "SELECT * FROM INTERVENTIONS_GEO_UNITES_RDC" + arg1 cursor.execute(sql) rows = cursor.fetchall() avec_rdc = (row for row in rows if rdc == True) for row in avec_rdc: trow = iCur.newRow() trow.INCIDENT_N = row[0] trow.DATE_INTER = row[2] trow.ADRESSE_IN = row[3] trow.TYPE_INT = row[4] trow.CAS_NO = row[5] trow.REGION = row[6] trow.CATEGORIE = row[7] trow.SITE_KEY = row[8] trow.ARRONDISSE = row[9] trow.LISTE_UNIT = row[11] trow.LONGITUDE = row[12] trow.LATITUDE = row[13] iCur.insertRow(trow) else: sql = "SELECT * FROM INTERVENTIONS_GEO_UNITES WHERE " + arg1 cursor.execute(sql) rows = cursor.fetchall() sans_rdc = (row for row in rows if rdc == False) for row in sans_rdc: trow = iCur.newRow() trow.INCIDENT_N = row[0] trow.DATE_INTER = row[1] trow.ADRESSE_IN = row[2] trow.TYPE_INT = row[3] trow.CAS_NO = row[4] trow.REGION = row[5] trow.CATEGORIE = row[6] trow.SITE_KEY = row[7] trow.ARRONDISSE = row[8] trow.LISTE_UNIT = row[9] trow.LONGITUDE = row[10] trow.LATITUDE = row[11] iCur.insertRow(trow)