How to configure rasa.db file in a different location?

I would like Rasa X to store conversations in data/rasa.db rather than simply rasa.db. Can someone help me how to achieve that? I tried something like this first example under SQLTrackerStore, but it doesn’t seem to work.

My endpoints.yml file:

tracker_store:
  type: SQL
  dialect: "postgresql"  # the dialect used to interact with the db
  db: "data/rasa"  # path to your db

Can someone point me to the right direction? Thanks in advance!

The .db files are SQLite, not PostgreSQL.

Not sure if this will work, but try dialect: "sqlite" (or don’t mention it at all since SQLite is default):

tracker_store:
  type: SQL
  db: "./data/rasa.db"

@morcosharcos you just want to store the the bot/user convocation in any database ?

For storing the bot/user conversation you can use tracker store:

Update this code in endpoints.yml

For Postgres:

tracker_store:
   type: SQL
   dialect: "postgresql"  # the dialect used to interact with the db
   url: "localhost"  # (optional) host of the sql db, e.g. "localhost"
   db: "chatbot"  # path to your db
   username: "postgres"  # username used for authentication
   password: "123"  # password used for authentication
   # query: # optional dictionary to be added as a query string to the connection URL
   #   driver: my-driver

For MySQL:

tracker_store:
   type: SQL
   dialect: "mysql+pymysql"  # the dialect used to interact with the db
   url: "localhost"  # (optional) host of the sql db, e.g. "localhost"
   db: "rasa"  # path to your db
   username: "root"  # username used for authentication
   password: "root"  # password used for authentication

Note: You also can need to install psycopg2-binary and pymysql. You will see when it will thrown error.

@morcosharcos You need to create a database schema i.e rasa (or whatever you feel like) and update same in db: rasa, train the bot and run rasa and rasa actions in separate terminals; whilst running you will get above mention errors or some other please install in your conda environment and again train and follow the process.

Good Luck!

@nik202 thank you for your answer, but these seem a little bit overkill for me. I just want to change the location of the .db file in order to have it attached as a volume to a docker container and keep the conversations when I release a new version through CI/CD (and not overwrite it with the dev environment’s conversations).

i just want to use the default way for everything, only difference being the location of the .db files. It really surprises me that it is that hard.

@ChrisRahme thank you too, I also hoped that something like this should be the answer but unfortunately this does not work.

1 Like

@morcosharcos I suggested to you what you had mention in the main topic post, there is nothing related to docker volume and docker containers.

For that, just use the SQL or Postgres Tracker store and you just need to mention in URL the IP address of the SQL Image container ( image which you had mention in docker-compose), I hope you will able to find it while inspecting the docker image.

I hope this will help you!

@nik202 Thanks again, but I still do not want to have a separate database for that. I mentioned docker just to give some context to why I want to do what I want to do. It seems I do not write what I want concisely and clearly enough, so that is a learning for me :slight_smile:

Anyways, I found a workaround. What I do is:

  • mount the external file to the container through docker-compose into the assistant’s root directory
  • when I release, the rasa.db file is overwritten in the assistant’s root directory
  • but docker-compose happens after container creation, so the outside file overwrites the one coming with the release
1 Like

@morcosharcos Great! Please mark the above post as solution for others.