<jupyter_start><jupyter_text>Programming and Database Fundamentals for Data Scientists - EAS503 The goal of PyMySQL is to be a drop-in replacement for MySQLdb and work on CPython, PyPy and IronPython. Installation```scriptpip install PyMySQL```or```scriptconda install PyMySQL```Might need `sudo` privileges depending on your Python installation. Start with a simple tableRun the following in your database```sqlCREATE TABLE `users` (    `id` int(11) NOT NULL AUTO_INCREMENT,    `email` varchar(255) COLLATE utf8_bin NOT NULL,    `password` varchar(255) COLLATE utf8_bin NOT NULL,    PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_binAUTO_INCREMENT=1 ;```<jupyter_code>import pymysql.cursors
# Connect to the database
connection = pymysql.connect(host='localhost',
                             user='root',
                             password='<PASSWORD>',
                             db='eas503db',
                             charset='utf8mb4',
                             cursorclass=pymysql.cursors.DictCursor)
try:
    with connection.cursor() as cursor:
        # Create a new record
        sql = "INSERT INTO `users` (`email`, `password`) VALUES (%s, %s)"
        cursor.execute(sql, ('<EMAIL>', '<PASSWORD>'))
    # connection is not autocommit by default. So you must commit to save
    # your changes.
    connection.commit()

    
finally:
    connection.close()
with connection.cursor() as cursor:
        # Read a single record
        sql = "SELECT `id`, `password` FROM `users` WHERE `email`=%s"
        cursor.execute(sql, ('<EMAIL>',))
        result = cursor.fetchone()
        print(result)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10744297719087635, 'fraction_numerical': 0.012605042016806723, 'mean_word_length': 2.940898345153664, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '515916', 'license': 'MIT', 'n_tokens_mistral': 506, 'n_tokens_neox': 473, 'n_words': 148, 'path': 'notebooks/.ipynb_checkpoints/PythonMysql-checkpoint.ipynb', 'repo_name': 'Nikita018/eas503-ub', 'size': '1687'}