do not remove stared invalid entries!

fetchall db querys
This commit is contained in:
ccppi 2024-08-08 08:50:43 +02:00
parent 71209e9b5f
commit 83e0d81ebe
2 changed files with 9 additions and 8 deletions

View File

@ -125,32 +125,30 @@ def isStillValid(file,skiprows):
rows = cursor.fetchmany(256)
h = httplib2.Http()
for row in rows:
#with requests.Session() as session:
print("row: ",row[0])
try:
(resp,content) = h.request(row[0], 'HEAD')
#page = session.get(row[0])
except IOError as e:
print("link is no valid URL so remove item")
print("error: ",e)
isLink = False
except httplib2.error.RelativeURIError:
isLink = False
print("RelativeURIError: Not a valid link")
rm_cursor = connection.cursor()
rm_itm = rm_cursor.execute(f"""DELETE from jobs WHERE link = ?;""",(row[0],))
isLink = False
print("RelativeURIError: Not a valid link")
#rm_cursor = connection.cursor()
#rm_itm = rm_cursor.execute(f"""DELETE from jobs WHERE link = ?;""",(row[0],))
finally:
try:
resp
except NameError:
print("Not a valid link")
rm_cursor = connection.cursor()
rm_itm = rm_cursor.execute(f"""DELETE from jobs WHERE link = ?;""",(row[0],))
rm_itm = rm_cursor.execute(f"""DELETE from jobs WHERE link = ? AND star != 1;""",(row[0],))
else:
if resp.status >= 400 or isLink == False:
print("link is no more valid, remove item")
rm_cursor = connection.cursor()
rm_itm = rm_cursor.execute(f"""DELETE from jobs WHERE link = ?;""",(row[0],))
rm_itm = rm_cursor.execute(f"""DELETE from jobs WHERE link = ? AND star != 1;""",(row[0],))
print ("Deletion resultet in: ", rm_itm)
print("result of commit: ", connection.commit())
return 0

View File

@ -270,6 +270,9 @@ class MainWindow(QMainWindow):
#self.model.setTable("")
self.model.setQuery(cmd +" ;")
#self.model.setTable("jobs")
while (self.model.canFetchMore()):
print("fetch iterations++")
self.model.fetchMore()
self.proxymodel2 = QSortFilterProxyModel(self)
self.proxymodel2.setSourceModel(self.model)