python - Restore a PostgreSQL database without setting the password in the environment -
i need make script in python calls pg_restore
restore database. far use batch file sets true password in pgpassword
, after restore sets garbage in var.
my problem have create environment variable set pgpassword='password'
can't expose password in environment because if there error in restore, pgpassword
have true password.
is there way send restore command password, 1 can firebird?
using windows xp/7/8 postgresql 9.x.
i suggest use .pgpass
file.
on microsoft windows file named
%appdata%\postgresql\pgpass.conf
(where%appdata%
refers application data subdirectory in user's profile)
you could set environment variable, right in trying avoid that. it's discouraged in manual:
pgpassword
behaves same password connection parameter. use of environment variable not recommended security reasons, operating systems allow non-root users see process environment variables via ps; instead consider using~/.pgpass
file
more access without password:
run batch file psql command without password
Comments
Post a Comment