'Expression {{current_username()}} is not being read properly by Superset row level security with Postgres

I have been trying to add Row Level Security to Superset and I have written this clause:

rls clause

when I hard code this clause in a select on the database it works as it should but when I try to dynamically call current_username() it does not read it properly.

This is what happens when I call current_username() on sqlLab:

sqlLab result

I am currently using Superset 0.999.0dev on docker, and I am connecting to a Postgres Database.



Solution 1:[1]

I figured it out! Basically what you need to do is follow this guide to get the docker image directly from github.

Once you have cloned the project, find the folder where the project is saved and look for docker/pythonpath/superset_config.py and, inside this file, place "ENABLE_TEMPLATE_PROCESSING":True inside FEATURE_FLAGS like so.

Once you are done editing the file you should be able to run the docker-compose command. FYI, it takes a little while to fully load.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arkays