# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/fabricate/fabricate-api-and-cli/fabricate-cli/cli-load-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
