Skip to content

Commit

Permalink
Merge pull request getredash#55 from KiiCorp/hide-unnecessary-tables-…
Browse files Browse the repository at this point in the history
…43-2

Restrict shown tables with schema.
  • Loading branch information
shinsuke-nara authored Feb 28, 2019
2 parents 3c9bbdc + db2d623 commit 674bf09
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion redash/query_runner/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ 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');
WHERE table_schema IN (
SELECT table_schema
FROM information_schema.table_privileges
WHERE grantee = (SELECT current_user)
AND table_schema NOT IN ('pg_catalog', 'information_schema')
GROUP BY table_schema
);
"""

self._get_definitions(schema, query)
Expand Down

0 comments on commit 674bf09

Please sign in to comment.