Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. config = {'user' : 'some_user',
  2. 'password': 'some_password',
  3. 'host' : '127.0.0.1',
  4. 'database': 'some_database',
  5. 'raise_on_warnings': True,
  6. }
  7. db = mysql.connector.connect(**config)
  8.  
  9. # wait some to make changes to the database using the HeidiSQL workbenches
  10.  
  11. db.commit() # even though Python has not changed anything which needs to be
  12. # committed, this seems necessary to re-read the db to catch
  13. # the changes that were committed by the other clients
  14. cursor = db.cursor()
  15. cursor.execute('some_SQL_query')
  16. for result in cursor:
  17. do_something_with(result)
  18. cursor.close()
Add Comment
Please, Sign In to add comment