Non public schema - Tracker store postgres

Hi,

When I enable Tracker store for postgres DB it writes the conversation data information in Public schema. How to modify the endpoint file to write into our own schema by specifying schema name?

Navin

Any thoughts?

Hi @Navin,

I believe you should be able to change the default behavior in one of two ways:

  1. Set the POSTGRESQL_SCHEMA env var as referenced here: rasa/constants.py at main · RasaHQ/rasa · GitHub

  2. Add a parameter to the query in your endpoints configuration as documented here: Tracker Stores where the query parameter, according to postgres docs, i believe should be currentSchema.

Hi @erohmensing,

Thanks for the response. Added the POSTGRESQL_SCHEMA env var in endpoint.yml file and specified the schema name. Getting the following error. Any other code we need to change to accommodate this env variable?

TypeError: __init__() got an unexpected keyword argument 'POSTGRESQL_SCHEMA' 

constants.py has the same contents as shown

===== last few lines from constants.py=============

# RabbitMQ message property header added to events published using `rasa export`

RASA_EXPORT_PROCESS_ID_HEADER_NAME = "rasa-export-process-id"

# Name of the environment variable defining the PostgreSQL schema to access. See

# https://www.postgresql.org/docs/9.1/ddl-schemas.html for more details.

POSTGRESQL_SCHEMA = "POSTGRESQL_SCHEMA"

# Names of the environment variables defining PostgreSQL pool size and max overflow

POSTGRESQL_POOL_SIZE = "SQL_POOL_SIZE"

POSTGRESQL_MAX_OVERFLOW = "SQL_MAX_OVERFLOW"

========================

Can you please post your endpoints.yml? POSTGRESQL_SCHEMA is an environment variable, not a parameter to add to the endpoints.yml. You can set it by running export POSTGRESQL_SCHEMA="myschemaname".

That is one option. The other option is by adding currentSchema under the query dictionary in the endpoints configuration.

Hi @erohmensing Please find the contents of endpoint.yml. Note: Posting only the uncommented portion of file and other parameters masked for data protection.

tracker_store: type: SQL dialect: “postgresql+psycopg2” url: “XXXX” port: XXXX db: “XXXX” username: “XXXX” password: “XXXX”

Should we add the parameter “query” to get this working in this file? if so could you please share some example?

Hi @erohmensing ,

Please update when you have a moment

Hi @Navin, I need my endpoints.yml to use environment variables from my Kubernetes cluster. Your query seems to be similar to mine. Can you tell me how will that be possible. Note: I’m not using Rasa X or helm deployment. I’ve done my own deployment.

@erohmensing if you could help out here, I would really be grateful.