MySQL tracker store gives error VARCHAR requires a length on dialect mysql

(Palash) #1

I was trying to use mysql as a tracker store. So following the documentation I added

    type: sql
    dialect: 'mysql+mysqlconnector'
    url: 'localhost'
    db: rasa
    username: root
    password: secret

in endpoints.yml file.

When I execute the rasa shell, I get an error like sqlalchemy.exc.CompileError: (in table ‘events’, column ‘sender_id’): VARCHAR requires a length on dialect mysql

I am using Windows 10 and python 3.6.8

How can I get rid of this ?

Thanks for your help.

(Toni) #2

Hi Palash,

I just had the exact same problem. It seems like an issue with the ‘sqlalchemy’ package when it tries to create the table column because no lenght is specified.

I found a ‘temporary’ solution:

Locate the following file:

~/.local/lib/python3.6/site-packages/sqlalchemy/dialects/mysql/ (might not be the same exact path) and right after the line: visit_VARCHAR

add the following:

if type_.length is None:
    type_.length = 1024 # change 1024 to whatever lenght value you need

Save the file and run rasa again. The table is created, and all varchar columns will have that exact size. I hope you can move on with this solution for the moment.


(Don’t forget this is a kind of ‘hack’ so once your table is created, you can actually remove those two lines.)

(Palash) #3

Hello @Marrahi, Thanks for your suggestion. I will try it.