# Preflight Check: Database Enricher (/docs/dsr-automation/preflight-and-enrichment/preflight-checks/preflight-check-database-enricher)

## Overview [#overview]

Enrichment can be performed by querying one of your databases via the `Database Enricher`, which allows the ability to populate a DSR by specifying a SQL query that will be run prior to the SQL query for the request. For example, you could write an SQL query that maps an email address to a set of `user_id`s and `phone`s that you have related to that email address.

## Configuration Steps [#configuration-steps]

Before getting started, you'll need to ensure you have the desired database integration already connection. Refer to our [Database Integration](../../../integrations/custom/database-integration.mdx) for more information.

Once your database integration is connected, you can configure your Database Enricher:

1. Go to the `Identifiers` section underneath `DSR Automation`

2. Select the `+` button beside the `Preflight & Identity Enrichment` section, which will open up a modal.

   ![Database Enricher Selection](/images/screenshot/2025-04-23-dsr-automation-identifiers-new-preflight-check.png)

3. Select the `Database Enricher` prefligh check and enter all the necessary information, which includes:

- `Database Data System` — Integration to run.
- `Title` — Title of preflight check
- `Description` — Description of preflight check
- `Input Identifier` — Initial identifier that should trigger the preflight check. If the request does not include this identifier, the preflight check will not be triggered.
- `Output Identifier` — The output identifier that will be mapped from the result of the SQL query
- `SQL Query` — The SQL query to run.
  - This field only appear after filling in all the prior fields.
  - Query has to be of type `SELECT`. Ex. `SELECT name FROM database WHERE email=?`
  - The `?` will be replaced with the `Input Identifier` value e.g. `user@acme.com`
- `Field to Identifier Mapping` — This is where we will map the result of the SQL query to the output identifier.
  - This field only appears after filling a valid `SELECT` SQL query
  - Mapping will be column names from the SQL query to the output identifier.
  - Each output identifier can be mapped to many column names
  - If the column name is a function, make sure to add an `AS` clause to map the result of the function
  - For any `AS` clause, only the word after `AS` will be used for mapping. Ex. `COUNT(name) AS total` then only `total` will be used for mapping

`Server=localhost;Database=example;Uid=admin;Pwd=testing;Port=5432;sslmode=disable;`
