Halo !
Ich habe ein a loop which iterate SQL queries and which output goes to an array.
Aber ales results seems to be blend. How can an I unblend them and have them separated by queries ?
Ich habe eine Schleife, die SQL-Abfragen iterieren Die Ausgabe erfolgt zu einem Array. Doch alle resluts scheinen zu mischen
Wie kann ich sie entblößen und sie durch Abfragen getrennt haben?
Code
- liste= [None]*len(res)
- for i, ids in enumerate(res['ids']):
- cur.execute(""" -- oft Menschen iLOC die Gruppe [i] [ 'Ids'] haben interragi mit Inhalt swipe.eclipse_id
- SELECT COUNT (swipe.state),swipe.eclipse_id FROM swipe
- WHERE (swipe.state= 2 OR swipe.state = 3 or swipe.state=5 OR swipe.state =6 or swipe.state=8 or swipe.state=9)
- AND swipe.subscriber_id in %s
- GROUP BY swipe.subscriber_id,swipe.eclipse_id
- ORDER BY (swipe.subscriber_id) ASC;""",
- (tuple(res.iloc[i]['ids']),))
- n = cur.fetchall()
- liste = [{'count': elem[0], "eclipse_id": elem[1]} for elem in n]