A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
1.3 KiB

# PostgreSQL
Summary: Work with Postgres databases.
## Common Options
- `admin_pass`: The password off the admin-authorized user.
- `admin_user`: The user name of the admin-authorized user. Default: `postgres`
- `host`: The host name. Default: `localhost`
- `port`: The TCP port. Default: `5432`
## Available Commands
### pgsql.create
Create a database. Argument is the database name.
- `owner`: The user name that owns the database.
```ini
[create the database]
pgsql.create: database_name
```
### pgsql.drop
Drop a database. Argument is the database name.
### pgsql.dump
Dump the database schema. Argument is the database name.
- `path`: The path to the dump file. Default: `dump.sql`
### pgsql.exec
Execute an SQL statement. Argument is the SQL statement.
- `database`: The name of the database where the statement will be executed. Default: `default`
### pgsql.exists
Determine if a database exists. Argument is the database name.
### pgsql.user
Create a user. Argument is the user name.
- `password`: The user's password.
```ini
[create a database user]
pgsql.user: username
```
Remove a user.
```ini
[remove a database user]
pgsql.user: username
op: remove
```
Determine if a user exists.
```ini
[determine if database user exists]
pgsql.user: username
op: exists
```