I am writing logs in mysql database and I create a table coordinates
, with the columns Id
, x
, y
. When I want to read from the db, I want to print the latest log each time:
cursor.execute("Select x,y from coordinates ORDER BY id DESC LIMIT 1")
for row in cursor.fetchall():
print(row[0])
It always returns the first row in the log which is not ordered by DESC. It seems that fetchall
changes the order of the log. Is there any solution?