RASA Tracker connection with SQL Server

Hello All,

We currently have running our chatbot in production server and all conversations are stored in SQLite but now we want to stored them in SQL Server table, we used the below configuration in our enpoints.yml:

tracker_store:
   type: SQL
   dialect: "mssql"
   url: "000.000.00.0"
   db: "DB_NAME"
   port: ""
   username: ""
   password: "
   query:
    driver: "FreeTDS"

but sometimes just stop working and does not save any conversation, we use rasa version 1.10.12

@kandykane how you installed the rasa chatbot for the production server?

@kandykane please also see this thread meanwhile : How can I install MySQL in my rasa environment? - #4 by nik202

Hello @nik202, thanks for replying we are using docker containers.

and also we already try this other dialect to connect, unfortunately didn’t worked.

tracker_store:
   type: SQL
   dialect: "mssql+pyodbc"
   url: "000.000.00.0"
   db: "DB_NAME"
   port: ""
   username: ""
   password: "
   query:
    driver: "FreeTDS"

@kandykane Interesting you have’nt mentioned that you are using docker containers. so in this use-case scenario, you need to mention the image of SQL or Postgres in the docker-compose, because you are running in a container-based environment.

Just for Demonstration purposes and here I’m using Postgres:

version: "3"
services:
  rasa:
    container_name: "rasa_server"
    user: root
    build:
      context: .
    volumes:
      - "./:/app"
    ports:
      - "5005:5005"
  action_server:
    container_name: "action_server"
    build:
      context: actions
    volumes:
      - "./actions:/app/actions"
      - "./data:/app/data"
    ports:
      - "5055:5055"
  db:
    container_name: postgresql_db
    image: postgres:latest
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 12453
      POSTGRES_DB: chatbot
    # automatically restarts the container - Docker daemon on restart or
    # the container itself is manually restarted
    ports:
      - "5432:5432"
    # networks:
    #   app_net:
    #     ipv4_address: 192.168.0.2

  pgadmin:
    container_name: pgadmin4
    image: dpage/pgadmin4
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: root@root.com
      PGADMIN_DEFAULT_PASSWORD: root
      # PGADMIN_LISTEN_PORT: 90
    ports:
      - "5050:80"
#     networks:
#       app_net:
#         ipv4_address: 192.168.0.3
# networks:
#   app_net:
#     ipam:
#       driver: default
#       config:
#         - subnet: "192.168.0.0/24"
#           gateway: 192.168.0.1

Please cross check the code or ref on google or youtube for postgres docker image.

Keep note, container IP changes dyanamically.

I hope this will help you.

1 Like

Thank you @nik202 definitely this will help me a lot :smiley:

@kandykane No worries, if this will help you please close the thread as a solution later :slight_smile: and if you have any doubts or errors keep me posted.

1 Like

Hi everybody, would this solution also work for a Microsoft SQL Server DB which is in a different server (non dockerized)

TIA

@jusce17 If you have container for that it will work.