

GRANT SELECT ON chartio_read_only.”Visitors” TO chartio_schema_user Grant permissions to select all data from the Visitors table.ĬREATE VIEW chartio_read_only.”Visitors” AS SELECT * FROM Visitors GRANT SELECT ON chartio_read_only.”Accounts” TO chartio_schema_user Your Accounts table has sensitive information in it, and you want Chartio to access only the Account_ID and Date_Created columns._ Run the following to add a view to the chartio_read_only schema and grant access to that view to the chartio_schema_user.ĬREATE VIEW chartio_read_only.”Accounts” AS SELECT Account_ID, Date_Created FROM Accounts CREATE OR REPLACE VIEW is similar, but if a view of the same name already exists, it is replaced.

Public | Subscriptions | table | postgres Instead, the query is run every time the view is referenced in a query. Take a look at the database relations using the d command. GRANT USAGE ON SCHEMA chartio_read_only TO chartio_schema_user GRANT CONNECT ON DATABASE databasename TO chartio_schema_user Run the following to return a list of tables in your database.Ĭreate a schema specific to Chartio’s read only user run the following:ĬREATE ROLE chartio_schema_user LOGIN PASSWORD ‘secure_password’ You may also to do this if your database has over 1000 tables and you are attempting to connect to Chartio.Ĭonnect to your PostgreSQL database using psql or pgadmin. However, if you need to limit access to specific columns you may need to use a combination of schemas and views to restrict access.
Create view psql how to#
Refer to the following instructions on how to limit access to certain tables. To limit PostgreSQL access to specific tables and columns you can use schema and selective GRANT statements.
