I am struggling with an minor issue that I am trying to create a table into MySQL using Python sqlalchemy, which crates table into the database not did not inserting rows into that. Below is the code. what is the mistake?
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine("mysql://root:1234@localhost:3306/paintings")
connection = engine.connect()
df = pd.read_csv("./data/artist.csv")
df.to_sql("artist", con=connection, index=False, if_exists="replace")

connection.commit()afterdf.to_sql("artist", con=connection, index=False, if_exists="replace")?