sqltrack.commands.create module

The create tool guides users through the creation of PostgreSQL users and databases.

This naturally requires privileged access to PostgreSQL. Rather than requiring these privileges, this tool will never execute any commands. It merely prints suggested commands that users can inspect, modify, and execute as they see fit.

Alternatively, you can pipe its output into a psql to execute the commands directly, e.g., for a locally running PostgreSQL:

sqltrack create | sudo -u postgres psql

If you don’t have access to psql, you can also use sqltrack execute:

sqltrack create | sqltrack execute

Regarding passwords:

If --password is specified, this tool will try to determine a password for the new user, first from the pgpass file, followed by prompting for it. To avoid printing it in plain text, it will then attempt to encrypt the password. To do so, it must connect to the database. Should this fail, you have two options to remedy the situation:

sqltrack.commands.create.create(config: dict, no_user: bool = False, no_db: bool = False, **kwargs)[source]