> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datafold.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Redshift

**Steps to complete:**

1. [Run SQL script and create schema for Datafold](/integrations/databases/redshift#run-sql-script-and-create-schema-for-datafold)
2. [Configure your data connection in Datafold](/integrations/databases/redshift#configure-in-datafold)

## Run SQL script and create schema for Datafold

To connect to Amazon Redshift, create a user for Datafold with two permissions:

* Read access (SELECT) to the schemas and tables you want to diff. Datafold only reads from your main database.
* Write access to one dedicated temporary schema, which Datafold uses to materialize scratch work and keep data processing in your warehouse.

Create the temporary schema, create the user, and grant these permissions with the script below. Repeat the two `GRANT ... <myschema>` statements for each schema you want Datafold to read.

```sql theme={null}
/* Create the temporary schema Datafold uses for scratch work */

CREATE SCHEMA datafold_tmp;

/* Create the datafold user */

CREATE USER datafold PASSWORD 'SOMESECUREPASSWORD';

/* Give the datafold user write access to the temporary schema */

GRANT ALL ON SCHEMA datafold_tmp TO datafold;

/* Give the datafold user read access to each schema you want to diff */

GRANT USAGE ON SCHEMA <myschema> TO datafold;
GRANT SELECT ON ALL TABLES IN SCHEMA <myschema> TO datafold;
```

<Note>Grant read access to every schema in your diff or CI scope. If Datafold references a schema the user cannot read, diffs and CI runs against that schema will fail.</Note>

### Column-level lineage (optional)

To build column-level lineage, Datafold reads Redshift's system query logs. Grant the user access to them:

```sql theme={null}
ALTER USER datafold WITH SYSLOG ACCESS UNRESTRICTED;
```

## Configure in Datafold

| Field Name                  | Description                                                                                                                                         |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name                        | A name given to the data connection within Datafold                                                                                                 |
| Host                        | The hostname of your cluster. (Go to Redshift in your AWS console, select your cluster, the hostname is the endpoint listed at the top of the page) |
| Port                        | Redshift connection port; default value is 5439                                                                                                     |
| User                        | The user created in our SQL script, named `datafold`                                                                                                |
| Password                    | The password created in our SQL script                                                                                                              |
| Database Name               | The name of the Redshift database you want to connect to                                                                                            |
| Schema for temporary tables | The schema (`datafold_tmp`) created in our SQL script                                                                                               |

Click **Create**. Your data connection is ready!
