Reading data from data base

Hi ,

in my project, i tried to collect data from user and store it in to SQL database

Can anyone help me with an example where Rasa is connected to sql database / Mongo Db for reading Data . Suppose i have collected an employee table with all the details from user, now i need the Bot to read the data from there and utter to the user

Thanks in advance.

You can read data from a database as with any Python code using the Python MySQL Connector.

Write the code as if it was standalone and unrelated to Rasa. Then, copy that code into a custom action (in the run() method of the action), and use dispatcher.utter_message(...) to display your results.

import pymysql import pymysql.cursors

pip install mysqlclient

This works well with unicode.