Whenever I am asking a question regarding database it is not giving me the output.
Example
Me - my pf uan number
Bot -
Domain.yml `intents:
- agent.acquaintance
- agent.age
templates:
utter_agent.acquaintance:
- "I'm a virtual agent"
- "Think of me as a virtual agent."
- "Well, I'm not a person, I'm a virtual agent."
- "I'm a virtual being, not a real person."
- "I'm a conversational app."
utter_agent.age:
- "I prefer not to answer with a number. I know I'm young."
- "I was created recently, but don't know my exact age."
- "Age is just a number. You're only as old as you feel."
actions:
- utter_agent.acquaintance
- utter_agent.age
- action_db`
Stories.md
`## story 01
*agent.acquaintance
- utter_agent.acquaintance
story 02
*agent.age
-
utter_agent.age
Story 87
*pf.uan.number
- action_db`
pf.uan.number.md
`## intent:pf.uan.number
- Give my uan number
- Lets go
- my pf uan number
- Your pf uan number
- What is pf uan number? `
action.py
`from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from rasa_core_sdk import Action
import pymysql
class ActionDb(Action):
def name(self):
return 'action_db'
def run(self, dispatcher, tracker, domain):
print("Hello1111")
db = pymysql.connect("xyz.net","admin","abcdefg","dbname")
cursor = db.cursor()
str1='PF_UAN_Number'
query = "SELECT COL_2 FROM csv_db1.TABLE_2 WHERE COL_1 = '" + str1 + "'"
cursor.execute(query)
data = cursor.fetchone()
print(data)
dispatcher.utter_message(data[0])
return []
`