# Profiles

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Profiles join customer profile data from your data warehouse with the behavioral product data already in Amplitude.

Profiles act as standalone properties. Each one attaches to a user profile instead of to a specific event, so it differs from a traditional user property and supports more expansive analyses.

Profiles always display the most current data synced from your warehouse.

Use Profiles when you need the current value of a user attribute, such as a propensity score or account tier. To import precomputed metric values that change over time, such as revenue or health scores, use [Aggregated Metrics](https://amplitude.com/docs/data/warehouse-metrics) instead.

## Before you begin

Regardless of whether you're using Snowflake or Databricks, Change Data Capture (CDC) doesn't support replacing existing tables. Instead, you must use incremental modeling. If the table you integrate with drops and replaces data, the connection breaks.

### Profiles limits

| Plan | Limits |
| --- | --- |
| Enterprise | 1 billion operations (insert / update / delete) per month |
| Growth | 300 million operations (insert / update / delete) per month |

Each profile must reference a `user_id`.

### Snowflake users

If this is your first time importing data from this table, set a data retention time and enable change tracking in Snowflake with the following commands:

```sql
ALTER TABLE DATAPL_DB_STAG.PUBLIC.PROFILES_PROPERTIES_TABLE_1 SET DATA_RETENTION_TIME_IN_DAYS = 7;
 
ALTER TABLE DATAPL_DB_STAG.PUBLIC.PROFILES_PROPERTIES_TABLE_1 SET CHANGE_TRACKING = TRUE;
```

On Snowflake Standard Edition plans, the maximum retention time is one day. If you're on this plan, set the frequency to 12 hours in later steps.

### Databricks users

Follow these instructions to [enable change tracking](https://docs.databricks.com/en/delta/delta-change-data-feed.html#enable):

- If you're working with a new table, set the table property `delta.enableChangeDataFeed = true` in the `CREATE TABLE` command: `CREATE TABLE student (id INT, name STRING, age INT) TBLPROPERTIES (delta.enableChangeDataFeed = true)`

  Also set `spark.databricks.delta.properties.defaults.enableChangeDataFeed = true` for all new tables.
- If you're working with an existing table, set the table property `delta.enableChangeDataFeed = true` in the `ALTER TABLE` command: `ALTER TABLE myDeltaTable SET TBLPROPERTIES (delta.enableChangeDataFeed = true)`

Set a [data retention period](https://docs.databricks.com/en/delta/history.html#configure-data-retention-for-time-travel-queries). The period must be at least one day, but in most cases set this period to seven days or longer. If your retention period is too short, the import process can fail.

## Set up a profile (Snowflake users)

To set up a profile in Amplitude, follow these steps:

1. In Amplitude Data, navigate to _Connections Overview_. Then in the _Sources panel_, click **Add More**. Scroll down until you find the Snowflake tile and click it.
2. On the _Set Up Connection_ tab, connect Amplitude to your data warehouse by filling in all the relevant fields under _Snowflake Credentials_, which the [Snowflake Data Import guide](https://amplitude.com/docs/data/source-catalog/snowflake#set-up-and-verify-the-connection) outlines. You can either create a new connection, or reuse an existing one. Click **Next** when you're done.
3. You can find a list of your tables under _Select Table_. To begin column mapping, click the table you want.
4. In the list of required fields under _Column Mapping_, enter the column names in the appropriate fields to match columns to required fields. To add more fields, click **+ Add field**.
5. On the _Select Data_ tab, select the `profiles` data type. Amplitude pre-selects the required change data capture import strategy for you, which appears under the _Select Import Strategy_ dropdown:

   - **Insert**: Always on, creates new profiles when added to your table.
   - **Update**: Syncs changes to values from your table to Amplitude.
   - **Delete**: Syncs deletions from your table to Amplitude.
6. When you're done, click **Test Mapping** to verify your mapping information. Then click **Next**.
7. Name the source and set the frequency at which Amplitude refreshes your profiles from the data warehouse. Set the frequency to 12 hours if you're on Snowflake Standard Edition.

## Set up a profile (Databricks users)

To set up a profile in Amplitude, follow these steps:

1. In Amplitude Data, navigate to _Connections Overview_. Then in the _Sources_ panel, click **Add More**. Scroll down until you find the Databricks tile and click it.
2. In the _Set Up Connection_ tab, connect Amplitude to your data warehouse. Have the following information ready:

   - **Server hostname**: The hostname of your Databricks cluster. You can find it in your cluster configuration by navigating to _Advanced Options > JDBC/ODBC > Server Hostname_.
   - **HTTP path**: The HTTP path of the cluster you want to connect to. You can find it in your cluster configuration by navigating to _Advanced Options > JDBC/ODBC > HTTP Path_.
   - **Personal access token**: Use the personal access token to authenticate with your Databricks cluster. [Learn how to create them here](https://docs.databricks.com/en/dev-tools/auth/index.html#common-tasks-for-databricks-authentication).

   Click **Next** when you're done.
3. You can find a list of your tables under _Select Table_. To begin column mapping, click the table you want.
4. In the list of required fields under _Column Mapping_, enter the column names in the appropriate fields to match columns to required fields. To add more fields, click **+ Add field**.
5. In the _Data Selection_ tab, select the `profiles` data type.
6. When you're done, click **Test Mapping** to verify your mapping information. Then click **Next**.
7. Name the source and set the frequency at which Amplitude refreshes your profiles from the data warehouse. The default frequency is 12 hours, but you can change it.

## Set up a profile (S3 users)

To set up a profile in Amplitude:

1. In Amplitude, navigate to _Data > Sources_ and click **+ Add Source**. Find and click Amazon S3.
2. Connect Amplitude to your S3 bucket. For more information about granting Amplitude access to your S3 bucket, refer to [Amazon S3](https://amplitude.com/docs/data/source-catalog/amazon-s3#give-amplitude-access-to-your-s3-bucket). Additionally, have the following information ready for the _Verify Instrumentation_ tab:

   - Bucket Name and Prefix where your profiles are stored.
   - AWS Role ARN, AWS External ID, and AWS Region.

   Click **Test Credentials** to confirm Amplitude can access your S3 bucket, then click **Next** and name your source.
3. In the _Select File_ tab, select the file type and click **See Preview** to confirm the files to import, then click **Next**.
4. On the _Configure Converter_ tab, select the _Profiles_ data type. Complete source fields for `user_id` and `mutation_type`, and add additional properties if needed. The _Data Preview_ section shows an example of what Amplitude is set to ingest.

   - `mutation_type` must be exactly one of the following strings, or Amplitude won't ingest the profile:

     - `INSERT` when creating new files.
     - `UPDATE` when syncing new values.
     - `DELETE` to remove profiles.
5. When you're done, click **Save and Enable** to enable the import and refresh of profiles.

## Data specifications

| Field | Description | Example |
| --- | --- | --- |
| `user_id` | Identifier for the user. Must have a minimum length of 5. |  |
| `Profile Property 1` | Profile property set at the user level. The value of this field is the value from the customer's source since last sync. |  |
| `Profile Property 2` | Profile property set at the user level. The value of this field is the value from the customer's source since last sync. |  |

Example:

```json
{
  "user_id": 12345,
  "number of purchases": 10,
  "title": "Data Engineer"
}
```

Refer to [this article for information on Snowflake profiles](https://amplitude.com/docs/data/source-catalog/snowflake#select-the-data-type).

## SQL template

```sql
SELECT
         AS "user_id",
         AS "profile_property_1",
         AS "profile_property_2"
FROM DATABASE_NAME.SCHEMA_NAME.TABLE_OR_VIEW_NAME
```

## Clear a profile value

When you remove profile values in your data warehouse, those values sync to Amplitude during the next sync operation. You can also use Amplitude Data to remove unused property fields from users in Amplitude.

## Sample queries

```sql
SELECT 
	user_id as "user_id",
	upgrade_propensity_score as "Upgrade Propensity Score",
	user_model_version as "User Model Version"
FROM
	ml_models.prod_propensity_scoring
```

```sql
SELECT 
	m.uid as "user_id",
	m.title as "Title",
	m.seniority as "Seniority",
	m.dma as "DMA"
FROM
	prod_users.demo_data m
```
