I guess the answer to my question is yes.
But it shouldn't be any issue to connect the Chatterbot to PostgresSQL?
Do you have any guide lines how to connect the Chatterbot to other databases?
Thanks
Christian
ChatterBot's `SQL Storage Adapter uses SqlAlchemy internally. According to the latest documentation, SQL Alchemy supports PostgresSQL. This is something that I haven't tested out so I'm not sure if it will work.
Sources
@gunthercox Next questions, is it then possible to have multiple databases sources?
I'm thinking to have a central Database where multiple chatterbot only will read from and also have a local database that contain data that Chatterbot can read/write to.
Thanks
@gunthercox will try with PostgreSQL and get back to you if it works or not.
Thank you, I will be interested to know if it works.
i actually used postgresql before even trying chatterbot with sqlite and it worked just fine.
i went back to test it again for you and came across #927 btw.
with the patch in #927 added to my personal code, it worked just fine. i've used sqlalchemy with postgresql and sqlite in another project of mine and it was seamless. you will need to install psycopg2 in order to use postgresql with sqlalchemy.
so:
pip install psycopg2
then set database uri to one of the following:
database_uri='postgresql://localhost/database_name',
database_uri='postgresql://localhost:port_number/database_name',
database_uri='postgresql://user:password@localhost/database_name',
database_uri='postgresql://user:password@remote_host/database_name',
database_uri='postgresql://user:password@remote_host:port_number/database_name',
you get the picture.
unless someone else beats me to it, i'll look and see if this can be added anywhere in the documentation and then recommend that this issue be closed.
-- les
@Issen007 the multiple databases sources question should probably be opened up in another issue as a feature request.
Thanks @lesleslie, I will try this tomorrow in our lab.
@lesleslie I did a quick test but I got a import issue when loading the chatterbot module.
It complain it can't import the StorageAdapter.
But I need some more time to verify what's going on.
@lesleslie I got the PostgreSQL connection to work. But now by changing the sql_storage.py but via the Django settings.py file.
Maybe the chatterbot works different between if you are going though the Django App and if you go though the pure python app.
Because if I only import the ChatBot module from chatterbot it doesn't complain during the load but it complain during the training but it complaining that the module chatbot.train.
Thanks
I will close this ticket because it works when I change the Django Settings for PostgreSQL and that is good enough for me.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
i actually used postgresql before even trying chatterbot with sqlite and it worked just fine.
i went back to test it again for you and came across #927 btw.
with the patch in #927 added to my personal code, it worked just fine. i've used sqlalchemy with postgresql and sqlite in another project of mine and it was seamless. you will need to install psycopg2 in order to use postgresql with sqlalchemy.
so:
pip install psycopg2
then set database uri to one of the following:
database_uri='postgresql://localhost/database_name',
database_uri='postgresql://localhost:port_number/database_name',
database_uri='postgresql://user:password@localhost/database_name',
database_uri='postgresql://user:password@remote_host/database_name',
database_uri='postgresql://user:password@remote_host:port_number/database_name',
you get the picture.
unless someone else beats me to it, i'll look and see if this can be added anywhere in the documentation and then recommend that this issue be closed.
-- les