Postgres
Use the following credentials to connect to your Postgres database:
- 1.
- 2.Port: The port that your database runs on. By default, this is 5432.
- 3.Username: The username to connect to.
- 4.Password: The password for this user.
- 5.Database: The name of the database that Shape should connect to.
- 6.Schema: The schema to read from - for most people, this will be "public".
Shape connects to all databases using SSL. Please ensure that your database can accept an SSL connection.
If you would like to create a new read-only user in Postgres, here are the commands to run:
-- Create a new Shape user
CREATE USER shape_user WITH PASSWORD 'your-strong-password';
-- Allow shape_user to connect to your database
GRANT CONNECT ON DATABASE your_database_name TO shape_user;
-- Allow the shape user to connect to the public schema (or replace with your chosen schema)
GRANT USAGE ON SCHEMA "public" TO shape_user;
-- Allow shape user to read table on the public schema (or replace with your chosen schema)
REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA "public" FROM shape_user;
GRANT SELECT ON ALL TABLES IN SCHEMA "public" TO shape_user;
-- Allow shape user to access future table on the public schema (or replace with your chosen schema)
ALTER DEFAULT PRIVILEGES IN SCHEMA "public" GRANT SELECT ON TABLES TO shape_user;
If you need to remove the read-only user, reversing the commands above is easy:
-- Revoke default privileges on the public schema (or replace with chosen schema)
ALTER DEFAULT PRIVILEGES IN SCHEMA "public" REVOKE ALL ON TABLES FROM shape_user;
-- Revoke all read access on the public schema (or replace with chosen schema)
REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA "public" FROM shape_user;
-- Revoke schema usage access from public schema (or replace with chosen schema)
REVOKE USAGE ON SCHEMA "public" FROM shape_user;
-- Revoke connect access
REVOKE CONNECT ON DATABASE your_database_name FROM shape_user;
-- Drop user
DROP USER shape_user;
Last modified 9mo ago