import os
import pymysql
conn = pymysql.connect(
    host=os.environ['MYSQL_HOST'],
    user=os.environ['MYSQL_USERNAME'],
    password=os.environ['MYSQL_PASSWORD'],
    database='enwiki_p',
    charset='utf8'
)
def runquery():
    with conn.cursor() as cur:
        cur.execute(newdb)
        cur.execute(newquery)
        result = cur.fetchall()
        print(result)
newdb = "USE eswiki_p"
newquery = "SELECT * from user where user_name = 'PatruBOT'"
runquery()
((1236142, b'PatruBOT', b'', None, None, None, None, None, None, None, None, None, b'20091001170425', None, 1140079, None),)
newquery = "SELECT * from revision where rev_user = 1236142"
runquery()
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.

Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)