Tasks for managing clusters, databases, users and configurations for a Postgres server.
Creates a database user and sets a password if given. You can pass additional creation flags with the flags parameter.
Return True if the database user already exists.
Execute a SQL query on the remote server. You can specify the DB and additional flags with the db and flags parameter. If use_sudo is True then this will be executed as the postgres user. Additional **kwargs are passed to sudo or run.
Creates a new database with a given owner (if given) and encoding. You can specify which database is copied to create the new one with the template parameter. Using 'template0' as the template will allow creating a database with a different encoding from the default, which can’t be done from template1.
Return True if the database already exists.
Uploads a configuration to /etc/postgresql/<version>/<cluster>/pg_hba.conf from a template. If not given the Postgres version will be detected on the server. The default template name is postgres/pg_hba.conf.
Drops and restores a given cluster. This is mainly used for provisioning a new server to ensure the cluster has the desired default encoding.