Can we connect Rasa open source with MySql and fetch output to chat output

My Team Leader told me to connect MySQL with Rasa opensource and fetch the data from database to show the output in the chat!! So is this even possible

you need to query the data into your custom file and return it.

Thanks @svshubham01

Can I do it like this

mydb = mysql.connector.connect(host="localhost",
mycursor = mydb.cursor()

mycursor.execute("USE cafeteria")

mycursor.execute(" SELECT * FROM classx WHERE sports = 'football'")
result = mycursor.fetchall()

and giving the result as output as a bot reply.

Is this the correct method