Multiple bots connected to same db

Hi, I have multiple rasa bots running in same server and all of them are connected to same mysql db with Webchat UI. How to identify which conversation is coming from which bot in events table of mysql db?

Hi @bharath-madduri! If I recall correctly, the events table doesn’t give the option to find out which bot it is coming from, so I think in general we would recommend setting up different DBs for different bots or one bot per server.

What’s the reason that you want to have them share the same DB? Maybe this video can also help

I have multiple bots. I need to pull event data for all these bots and feed to the analytics system. For that I had to write ETL jobs to do the bot Mapping and feed them to analytics.

@kalkbrennerei I solved the issue. To achieve that I have added a new key in tracker store of endpoints.yml and made core level changes in tracker_store.py by that in events table a new column is added and value is passed from endpoints.yml

1 Like

@bharath-madduri Heya. Can you share some code snippet for other users reference; if you got some time? Many thanks in advance.

I have tried only on MySQL Database.
To add extra columns in events table following approach worked for me.

First I have added a key to tracker_store in endpoints.yml for MySQL Database , the key name I used is Bot_id

and in rasa/core folder you will find tracker_store.py file you need to add the following code in SQLTrackerStore Class

I didn’t know how to pass the Bot_id to save method, that is why declared a global variable and stored the Bot_id in it.

In the same SQLTrackerStore Class you find save method, add the following variable before commit().

image

Bot_id column and value added to MySQL Database.

1 Like

@bharath-madduri Perfect Bharath, nice approach. I will even try in my other project use case. Many thanks for the solution and good luck for your project.

1 Like