pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
This PR adds the ability to specify which database psql should connect to for postgres/postgresql operaitons and facts.
I can into an issue where I wanted to create a postgres role my_role with CREATEDB, and then connect as that new user to create a database that they owned. Because postgres defaults to connecting to the db with the same name as the role, I would get an error like: FATAL: database "my_role" does not exist.
This method is necessary when using managed postgres services from cloud providers that don't provide superuser access, meaning you can't change the owner of a database.
This PR adds the ability to specify which database
psql
should connect to for postgres/postgresql operaitons and facts.I can into an issue where I wanted to create a postgres role
my_role
withCREATEDB
, and then connect as that new user to create a database that they owned. Because postgres defaults to connecting to the db with the same name as the role, I would get an error like:FATAL: database "my_role" does not exist
.This method is necessary when using managed postgres services from cloud providers that don't provide superuser access, meaning you can't change the owner of a database.