자주 까먹는 명령어
사용자 생성
create role <username> with login password <password>;
권한 지정
grant usage on schema public to <username>;
grant all on schema public to <username>;
grant all privileges on database <dbname> to <username>;
grant all on all tables in schema public to <username>
grant select on <table> to <username>;
커넥션 현황 보기
SELECT count(*) from pg_stat_activity;
파이썬에서 사용하기
import psycopg2
conn = psycopg2.connect('host=db.com user=youngrok password=blahblah dbname=mydb
cursor = conn.cursor()
cursor.execute('SELECT * FROM auth_user')
print cursor.fetchall()