I have a MySQL connection in Python where I connect to a MySQL server and use workbench to transform the data. I now want to put the SQL code itself in Python, and want to use the cursor object to run my SQL code. How do I establish a cursor object when I'm using an engine? Here is the code I'm working with: import mysql.connector as mysql import pandas as pd from sqlalchemy import create_engine connection_string = "mysql+mysqlconnector://root:xxx@localhost:xxx/xxx" engine = create_engine(connection_string) And what I want to do is create a cursor object so I can run all of my SQL code like so: cursor = connection.cursor() sql = "XYZ" cursor.execute(sql) I've been trying to figure out the proper syntax to go from the engine I've created in the first block of code to running the SQL through a cursor in the second. Any help would be greatly appreciated Continue reading...