Fehler bei der SQL-Abfrage wird abgefangen
This commit is contained in:
parent
fb5b343025
commit
bf53722a30
1 changed files with 10 additions and 7 deletions
|
|
@ -40,15 +40,18 @@ while start <= anzahl:
|
||||||
print(start,' von ',anzahl)
|
print(start,' von ',anzahl)
|
||||||
sql = "INSERT INTO `test`(`nr`, `Filosophiefact`) VALUES ('" + str(start) + "','" + filosophie + "')"
|
sql = "INSERT INTO `test`(`nr`, `Filosophiefact`) VALUES ('" + str(start) + "','" + filosophie + "')"
|
||||||
sql_q = "SELECT * FROM test WHERE Filosophiefact like '%" + str(filosophie) + "%'"
|
sql_q = "SELECT * FROM test WHERE Filosophiefact like '%" + str(filosophie) + "%'"
|
||||||
resp = cursor.execute(sql_q)
|
|
||||||
if resp == 0:
|
try:
|
||||||
try:
|
resp = cursor.execute(sql_q)
|
||||||
resp = cursor.execute(sql)
|
if resp == 0:
|
||||||
except:
|
try:
|
||||||
print('Es gab ein Problem beim Schreiben des facts in die DB')
|
resp = cursor.execute(sql)
|
||||||
|
except:
|
||||||
|
print('Es gab ein Problem beim Schreiben des facts in die DB')
|
||||||
|
except:
|
||||||
|
None
|
||||||
connection.commit()
|
connection.commit()
|
||||||
start +=1
|
start +=1
|
||||||
time.sleep(1)
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue