# Using the CLI to load data

To generate data and load it into a PostgreSQL database, use the `load` command:

```
fabricate load \
  --source <fabricate_database_name> \
  --target <target_database_name> \
  --type <database_type> \
  --create \
  --user <username> \
  --host <host> \
  --port <port>
```

## Parameters

The `load` command accepts the following parameters:

* `source` - The name of the Fabricate database to use.
* `target` - The name of the database to populate.
* `create` - When included, indicates to create the database if it does not already exist. If not included, then the database must already exist.
* `refresh` - If included, Fabricate regenerates the data from scratch. If not included, then the previously generated data is used.
* `type` - The type of the target database platform. Currently only `postgres` is supported.
* `user` - The database user to connect with.
* `host` - The hostname of the target database.
* `port` - The port on which to connect.

## How the data is loaded into PostgreSQL

To load data into PostgreSQL, the CLI uses the `psql` command.

Make sure that the `psql` command is available in your `PATH`.

Set the `PGPASSWORD` environment variable to the password for the user specified in the `--user` parameter.
