Running Postgres insert sql using command prompt informatica

212 Views Asked by At

I am running the below postgres insert sql script through informatica command prompt. Able to run the script successfully.

Only issue is in script we are passing password as hardcoded value but its not secure and moreover not sure how to change it dynamically for dev and prod. Need suggestion how to keep the password as secret and how to change it dynamically for dev and prod. Below is the command we are using and **** is basically where we are passing the password.

PGPASSWORD=***** psql -U username -h host -d databasename -f source filename path

1

There are 1 best solutions below

2
Koushik Roy On

Use pmpasswd utility.

  1. encrypt the pass using this pmpasswd newpass. Assume output is ABCX6789
  2. Set an environment variable using this PGPASS = ABCX6789. Export the variable for UNIX/LINUX.
  3. use above parameter PGPASS in your psql... command. Please note to initiate the psql using infa command line utility.

When password changes, you just have to change the pass in environment variable and not in tool.

This also give you an extra layer of security since you arent mentioning text password in informatica script.