Issue Summary

Is it possible to concatenate queries with query username in SQL comments? I need this to identify who is running slow queries from the database logs.

I am looking for something like this:

SELECT * FROM users LIMIT 10 /* Redash User: user@example.com */

I looked into the available environment variables supported by redash, but couldn’t find anything that could support this.

Technical details:

  • Redash Version: 7.0.0+b17535 (15c815fb)
  • Browser/OS: Chrome: 83.0.4103.97
  • How did you install Redash: Manual Install on Ubuntu

We don’t support this directly. But since the code is open source you can could enable this for your data source of choice. Just modify the query runner to insert whatever contextual information you wish to include.

It would be quite complicated for us to support it for every database so I don’t expect this will be added to the main product.

1 Like

Hello susodapop,

I would be happy to make the change myself. Is there a public documentation on how to extend/modify query runner module on Redash? Or at lease could you please tell me which file to update?

Thanks.

Sure. Suppose you need to edit the Postgres query runner, you would edit this file in redash/query_runner/pg.py.

1 Like