Python Fetchone Method
The fetchone() method is used to fetch only one row from the table. The fetchone() method returns the next row of the result-set.
Python Fetchone Example
import mysql.connector myconn = mysql.connector.connect(host = "localhost", user = "root",password = "naveen",database = "PythonDB") cur = myconn.cursor() try: cur.execute("select name, id, salary from Employee") result = cur.fetchone() print(result) except: myconn.rollback() myconn.close()