Database (MySQL) conncectivity for custom actions

Hi @nitz Try installing rasa==1.6.1 and rasa-sdk==1.6.1.

hi @varunsapre10 i tried to install rasa sdk 1.6.1 some error appeared :slight_smile: ERROR: rasa 1.6.0a1 has requirement rasa-sdk~=1.5.0, but you’ll have rasa-sdk 1.6.0 which is incompatible.

Bro help me with it tell me when u will be free, can we just fix this out ??

hey @Ujjwalsas9 can u share ur action.py file as i m working on that onle and getting the same issue

hey @nitz, can you upgrade your rasa using the below command and check if you still face the same error:

pip install --upgrade rasa

Hey @nitz, I have written the sample code to fetch data from MySQL DB into custom actions, you can get the code here:

Let me know if this helps you :slight_smile:

ye sure will try it nd will let u know, thanks @JiteshGaikwad Btw this is my action.py file check it out once actions.py (1.1 KB)

I have a problem. Everything works fine when I run my code on Rasa X. But when I try to implement it with my custom web app or Slack the database queries aren’t executing. Any ideas as to why this is happening?

I am using @JiteshGaikwad Webapp to connect with my Rasa bot. I have the rest uncommented in my credentials file. The code is code working till my custom actions but not executing my sql queries

Same here sql queries are not getting executed. @JiteshGaikwad Could u please help us out in this Action server is running but not getting queried data as response

@Prskriti, can you share the contents of action.py file.

Here are the contents of actions.py:

actions.py (727 Bytes)

hey @Prskriti, can you test this file and check whether you are able to get the result.

I had tested dbConnect.py working and is giving desired output:

Can you check whether it’s printing the result of the below line in your actions.py file:

Also do check the value of client = tracker.get_slot('id') of your actions.py file.

I had the same issues. The elements were being returned as null but the data was present.

This might solve your problem: dispatcher.utter_message(text=f"data : {data}")

I hope @JiteshGaikwad can give us a better fix because this doesn’t print in a format :frowning:

@zaidalvi, can you just show me the output of data object

This is the output for the data object:

data: [(‘Taste of China / Huaxia Chinese Restaurant’,), (‘Mei Kong’,), (‘Desi Dera Restaurant’,), (‘Punj Vehra’,), (‘Lalqila Restaurant’,)]

hey @zaidalvi, check this stakoverflow solution, it may help you: