Postgres 권한
Postgres 권한 (Postgres Permissions)
Postgres에서 권한은 서로 다른 데이터베이스 객체에 대해 특정 작업을 수행할 수 있는 사용자를 제어하는 데 사용돼요. SQL 문으로 Postgres 데이터베이스의 권한을 관리할 수 있어요.
출처: 문서
본문
Postgres 권한 예시 (Example Postgres permissions)
다음 예시는 권한을 관리할 때 사용할 수 있는 SQL 문을 보여줘요. 이 예시들은 스키마 생성, 기존 데이터 읽기, information schema 접근 같은 권한 문제 없이 dbt를 매끄럽게 실행할 수 있게 해줘요.
database_name, source_schema, destination_schema, user_name은 플레이스홀더라서 조직의 명명 규칙에 맞게 바꿔 사용하면 돼요.
grant connect on database database_name to user_name;
-- Grant read permissions on the source schema
grant usage on schema source_schema to user_name;
grant select on all tables in schema source_schema to user_name;
alter default privileges in schema source_schema grant select on tables to user_name;
-- Create destination schema and make user_name the owner
create schema if not exists destination_schema;
alter schema destination_schema owner to user_name;
-- Grant write permissions on the destination schema
grant usage on schema destination_schema to user_name;
grant create on schema destination_schema to user_name;
grant insert, update, delete, truncate on all tables in schema destination_schema to user_name;
alter default privileges in schema destination_schema grant insert, update, delete, truncate on tables to user_name;
자세한 내용은 공식 문서를 확인하세요.
더 알아보기 (Learn more)
- Postgres 공식 권한 문서를 참고하세요: PostgreSQL GRANT documentation.