Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save v1nc3ntlaw/e1cf39e3f54741a47c1412a129f1f57c to your computer and use it in GitHub Desktop.
Save v1nc3ntlaw/e1cf39e3f54741a47c1412a129f1f57c to your computer and use it in GitHub Desktop.
πŸ‘β€πŸ—¨ PostgreSQL: Create readonly user
-- create user (e.g. metabase)
create user metabase with encrypted password 'password';
-- allow user connect to db
grant connect on database site to metabase;
-- allow user access to schema
grant usage on schema public to metabase;
-- grant select on existing tables
grant select on all tables in schema public to metabase;
-- allow user to access all tables in schema
alter default privileges in schema public
grant select on tables to metabase;
-- limit number of connections
-- alter role metabase with connection limit 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment