MySQL query using slots

Hey, I am trying to create a custom action by querying a database based on the slot value. But the query is not able to fetch the data from the database.

Hello @shena for mysql query you have to use my sql connector in your action.py file

import mysql.connector as mysql

class ActionAPI(Action):
    def name(self) -> Text:
        return "action_api"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        db = mysql.connect(
            host="localhost/host_url",
            user="user_name",
            passwd="password",
            database="database_name"
        )
        cursor = db.cursor()

        query = "SELECT name FROM student where id = 14"
        cursor.execute(query)
        records = cursor.fetchall()
        for record in records:
            print(record)
            records = """The detail is as follows {}.""".format(record)
        dispatcher.utter_message(records)
        return []

use above code in your example.