Hi, I recently installed Redash 3 to connect with our Postgres. When tested using my Postgres admin user, the query window can list all available tables. Then I create a specific role for Redash, (e.g ‘redash’) with only granted select and execution on objects in public schema. When I open the query window again (this time using ‘redash’ to connect to Postgres) the table list is gone. I thought something not right with my config at first, but then I noticed that I can get the list back when switched again my datasource connection to admin user for Postgres.
I want to know how Redash listing Postgres objects, since I don’t want to grant entire pg_catalogs content to this 'redash ’ role.
This site is in read only mode. Please continue to browse, but replying, likes,
and other actions are disabled for now.
Two queries are executed
Link to code
def _get_tables(self, schema):
query = """
SELECT table_schema, table_name, column_name
FROM information_schema.columns
WHERE table_schema NOT IN ('pg_catalog', 'information_schema');
"""
self._get_definitions(schema, query)
materialized_views_query = """
SELECT ns.nspname as table_schema,
mv.relname as table_name,
atr.attname as column_name
FROM pg_class mv
JOIN pg_namespace ns ON mv.relnamespace = ns.oid
JOIN pg_attribute atr
ON atr.attrelid = mv.oid
AND atr.attnum > 0
AND NOT atr.attisdropped
WHERE mv.relkind = 'm';
"""
self._get_definitions(schema, materialized_views_query)
return schema.values()
1 Like