Hello, I am facing a issue in connection with server while I tried to store data (email and number) in sqlite database. I have created database and tables manually .
My action.py file is::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher import sqlite3
class get_email(Action): def name(self) → Text: return “action_email_data”
async def run(self, dispatcher, tracker: Tracker, domain: Dict[Text, Any],) -> List[Dict[Text, Any]]:
dispatcher.utter_message(tracker.get_slot('email'))
conn = sqlite3.connect('mu_students.db')
#dispatcher.utter_message(conn)
cursor = conn.cursor()
#print("Creating Table")
#sql="CREATE TABLE mu_stu (Email NVARCHAR(50),Enrollment NVARCHAR(50));"
#cursor.execute(sql)
dispatcher.utter_message(text="Entering email and enrollment to db...")
sql="INSERT INTO mu_stu (Email, Enrollment) VALUES (?, ?);"
cursor.execute(sql,(tracker.get_slot('email'), tracker.get_slot('enrollment')))
# Commit your changes in the database
conn.commit()
#dispatcher.utter_message(cursor.rowcount)
#cursor.execute("SELECT * FROM mu_stu")
#Closing the connection
conn.close()
dispatcher.utter_message(tracker.get_slot('enrollment'))
return []
my story is::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- story: email_issue_C
steps:
- intent: password_reset
- action: utter_password_reset
- intent: inform_email
entities:
- email: “mehul@gmail.com”
- action: utter_password_reset_verify
- intent: inform_enrollment
entities:
- enrollment: “209977543211”
- action: utter_student_enrollment_greet
- action: utter_email_info_display
- action: action_email_data
endpoints.py:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ‘’’
# This file contains the different endpoints your bot can use.
# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
#models:
# url: http://my-server.com/models/default_core@latest
# wait_time_between_pulls: 10 # [optional](default: 100)
# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions
action_endpoint:
url: "http://localhost:5055/webhook"
# Tracker store which is used to store the conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/tracker-stores
#tracker_store:
# type: redis
# url: <host of the redis instance, e.g. localhost>
# port: <port of your redis instance, usually 6379>
# db: <number of your database within redis, e.g. 0>
# password: <password used for authentication>
# use_ssl: <whether or not the communication is encrypted, default false>
#tracker_store:
# type: mongod
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
# db: <name of the db within your mongo instance, e.g. rasa>
# username: <username used for authentication>
# password: <password used for authentication>
# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/event-brokers
#event_broker:
# url: localhost
# username: username
# password: password
# queue: queue
‘’’
Error is::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::