fabtools.require.postgres

PostgreSQL users and databases

fabtools.require.postgres.server(version=None)[source]

Require a PostgreSQL server to be installed and running.

from fabtools import require

require.postgres.server()
fabtools.require.postgres.user(name, password, superuser=False, createdb=False, createrole=False, inherit=True, login=True, connection_limit=None, encrypted_password=False)[source]

Require the existence of a PostgreSQL user.

The password and options provided will only be applied when creating a new user (existing users will not be modified).

from fabtools import require

require.postgres.user('dbuser', password='somerandomstring')

require.postgres.user('dbuser2', password='s3cr3t',
    createdb=True, create_role=True, connection_limit=20)
fabtools.require.postgres.database(name, owner, template='template0', encoding='UTF8', locale='en_US.UTF-8')[source]

Require a PostgreSQL database.

from fabtools import require

require.postgres.database('myapp', owner='dbuser')