Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config = {'user' : 'some_user',
- 'password': 'some_password',
- 'host' : '127.0.0.1',
- 'database': 'some_database',
- 'raise_on_warnings': True,
- }
- db = mysql.connector.connect(**config)
- # wait some to make changes to the database using the HeidiSQL workbenches
- db.commit() # even though Python has not changed anything which needs to be
- # committed, this seems necessary to re-read the db to catch
- # the changes that were committed by the other clients
- cursor = db.cursor()
- cursor.execute('some_SQL_query')
- for result in cursor:
- do_something_with(result)
- cursor.close()
Add Comment
Please, Sign In to add comment