The Trade Desk connector for Snowflake: Third-party segments
Advertisers and data providers can use The Trade Desk connector native app to upload third-party audience data to The Trade Desk using Snowflake. The Trade Desk connector native app helps streamline data integration with The Trade Desk and includes support for UID2 mapping from email addresses and phone numbers. It provides a flexible, guided, and secure setup experience that works across all Snowflake-supported environments and a variety of advertising use cases.
Audience segment upload processing is designed for volume and performance at scale. It works by processing records that you populate into the input table. To transfer data to The Trade Desk DSP for your use, the native app performs the following actions:
- Reads the payload from the input table.
- Performs simple validation.
- Performs ID translation as needed.
- Performs splitting and batching, and handles retries if needed.
What you need to know
Here's what you need to know about preparing your audience segment data for processing:
- You must use SQL to prepare data and copy it into the input table.
- The uploaded data must be in a format consumable by the POST /data/thirdparty endpoint. For specific data requirements, see SQL objects.
- The native app supports multiple user ID types as well as raw email addresses and phone numbers for UID2 processing. For details, see Supported ID types.
- The
TTL_In_Minutesfield establishes the Time To Live (TTL) for each user ID to remain targetable. The maximum TTL is 180 days (259200 minutes), and the default TTL is 90 days (129600 minutes). To remove an inactive user, you can set this property to0for that user or delete the row for the user.
Here's what you need to know about processing the segments:
- The native app includes a Snowflake triggered task. If the user starts the triggered task, it checks regularly for new records in the input table and runs whenever it detects new data.
- The native app uses a Snowflake stream to track changes on the table and determine which records to process with each execution. Existing, unchanged records are not reprocessed.
- Do not delete rows unless you are certain you want to delete those IDs from the segment.
- The native app includes a user interface, but all functions can be automated with SQL commands via tables, views, and stored procedures. For details, see Stored procedures.
- There is no limit on how many IDs you can process. The native app takes care of splitting and batching for you, using the value provided in the
BATCH_SIZEparameter. For details, see Stored procedures.
Snowflake marketplace listing
The following listing from The Trade Desk for processing audience data in Snowflake is available in the Snowflake marketplace:
- TTD Connector: Audience & Conversion Data
Complete setup steps
Before processing the data, you must complete all the steps covered in The Trade Desk connector for Snowflake: Get started, including the following setup tasks:
- Grant permissions.
- Complete pairing steps.
- Specify the main partner you want to work with.
- For the specified partner, select one or more advertisers you want to work with.
For details, see Configure the native app.
Process data
Processing of new or changed audience segments starts in one of these ways:
- When you call the stored procedure
APP.SP_START_SEGMENT_TASK_3PD, which detects changes in the data table and starts the Snowflake triggered task. - When you initiate processing via the Snowflake Native App UI or by running the
APP.SP_PROCESS_SEGMENTS_3PD(BATCH_SIZE INT, STOP_AFTER_SECONDS INT)stored procedure.
TIP: When you're processing data for the first time, we recommend using a small amount of data, such as 100 IDs. On a smaller dataset it's easier to make sure that processing goes smoothly, and to troubleshoot if needed. When you've confirmed that everything is working smoothly for this small amount, you can process large volumes of data.
To process segments in the Snowflake Native App UI, follow these steps:
- Copy data from your own database into the input table, transforming the data as needed to meet the formatting requirements. For details, see SQL objects.
- On the Segments page, click Refresh to check that the data has been added in the Unprocessed Counts field and that the counts are accurate.
- Click Process Immediately. This triggers execution.
- Check that your new counts are displayed in the Successful field.
Verify data processing
There are several ways you can verify that your data was processed correctly:
- In the native app, refresh the Segments page and check for success and errors.
- In Snowflake, check the
APP.VW_AUDIENCE_SEGMENT_RESULT_3PDview. If there are errors, see Error messages. For details about the views, see Tables and views. - After an hour or two, the segment becomes visible in The Trade Desk platform. In the platform UI, go to the Advertiser Data (One) tile and select the My Imported Data tab.
- Confirm with your Technical Account Manager, who verifies that the data was successfully ingested and validates the data within The Trade Desk platform.
Reference information
The following sections provide reference information for using this connector, such as supported ID types, tables and views, stored procedures, and example commands.
Segments page
The Segments page shows dimensions of your segments information, along with some simple controls to manage execution. The table schema was created during configuration (see Configure the native app), and includes fields for the data elements (see SQL objects).
The following summary information is at the top of the page:
- Segments Third Party Data (3PD) Summary: This table summarizes count and percentage for the following statuses: Unprocessed, Successful, Failed. It also shows totals.
- Most Recent Failed IDs (by ERROR_CODE): Includes error codes and a count for each.
IMPORTANT: For information about the expected format of the data, see POST /data/thirdparty. The field names might not be identical.
The following table lists the buttons on the Segments page and what they do.
| Button | Function |
|---|---|
| Process immediately | Checks the input table for items that haven't been processed yet, and immediately submits them to the authorized URL for processing, per the External Integration Binding permission (see Native app permissions). |
| Start task | Starts a task that checks the input table for changes and submits new changes regularly to the authorized URL for processing, per the External Integration Binding permission (see Native app permissions). |
| Stop task (Only present when a task is running) |
Stops the current process from running. You could use this, for example, if you're getting errors and you want to stop and try to fix the problem. |
| Refresh | Refreshes the page in The Trade Desk connector native app. This button refreshes only the UI; it does not affect the processing of data. It refreshes values displayed, such as the number of segment IDs processed. |
Supported ID types
The Trade Desk connector native app supports a subset of the ID types supported by The Trade Desk external provider third-party data endpoint (see POST /data/thirdparty), as well as additional ID types to support the processing of UID2s. The following table lists all supported ID types.
IMPORTANT: Only the ID types listed in this table are supported. The following ID types require UID2 signed paperwork and the associated additional permissions:
UID2,UID2Token,phone,email_hash, andphone_hash.
| ID Type | Data Type | Description |
|---|---|---|
TDID |
GUID | The Trade Desk 36-character GUID (including dashes) for this user. |
DAID |
GUID | The raw device ID for this user, sent in 36-character GUID format (including dashes). Use the iOS ID for advertisers (IDFA) or Android advertising ID (AAID). |
UID2 |
String | The raw UID2 value, also known as UID2. This value is case-sensitive. Raw UID2s are generated and managed using UID2 APIs. See also Unified IDs. |
UID2Token |
String | The encrypted UID2 token, also known as an advertising token. This token is case-sensitive. Tokens are generated and managed using UID2 APIs. For details about UID2 APIs, see UID2 Endpoints: Summary. For details about UID2 tokens, see Raw IDs vs. tokens. |
RampID |
String | The 49-character or 70-character RampID (previously known as IdentityLink). IMPORTANT: This must be a RampID from LiveRamp that is mapped specifically for The Trade Desk. For details about mapping a RampID, see LiveRamp documentation. |
ID5 |
String | The ID5 for the user. Data providers holding these IDs should engage with ID5 directly to obtain the necessary decryption keys. For details about ID5, see the ID5 site. IMPORTANT: The ID5 ID is supported only in Europe and must be in decrypted form. |
netID |
String | The user's netID as a 70-character Base64-encoded string. For details about netID, see the netID Developer Zone. IMPORTANT: This ID is supported only in Europe. |
FirstId |
String | The user's First-id, a first-party cookie typically set by publishers in France. For details about First-id, see the First-id site. IMPORTANT: This ID is supported only in Europe. |
email |
String | A raw email address for conversion to a UID2. The native app normalizes and hashes the email address before sending the data to The Trade Desk. It never sends raw email addresses outside your Snowflake account. |
phone |
String | A raw phone number for conversion to a UID2. The native app normalizes and hashes the phone number before sending the data to The Trade Desk. It never sends raw phone numbers outside your Snowflake account. |
email_hash |
String | A hashed email address for conversion to a UID2. For requirements, see Email address hashing and encoding. |
phone_hash |
String | A hashed phone number for conversion to a UID2. For requirements, see Phone number hashing and encoding. |
SQL objects
The Trade Desk connector native app creates a data table, INPUT.AUDIENCE_SEGMENT_3PD, for the segments data.
The following table lists the column names, in sequence.
NOTE: The uploaded data must be in a format consumable by the POST /data/thirdparty endpoint. Fields that occur in the API are defined in detail in the linked endpoint documentation.
| Column Name | SQL Data Type | Notes |
|---|---|---|
RECORD_ID |
INT | A unique ID assigned to the record. Each time a new row is added, the value increases. |
ID_TYPE |
VARCHAR | Supports any one of the user ID types listed in Supported ID types. |
ID_VALUE |
VARCHAR | Supports the value for any one of the user ID types listed in Supported ID types: for example, ID_TYPE of email and ID_VALUE of user123@example.com. For an example with multiple IDs, see Insert multiple user IDs for an audience segment. |
SEGMENT_NAME |
VARCHAR | See Data object in the POST /data/thirdparty endpoint documentation. |
DATA_PROVIDER_ID |
VARCHAR | Your ID, assigned to you by The Trade Desk. |
TTL_IN_MINUTES |
INT | See Data object in the POST /data/thirdparty endpoint documentation. |
TIMESTAMP_UTC |
TIMESTAMP_NTZ | See Data object in the POST /data/thirdparty endpoint documentation. For usage, see FAQs. |
LAST_UPDATED_ON_UTC |
TIMESTAMP_NTZ | An optional value that triggers re-processing of the record. For usage, see FAQs. |
Tables and views
The native app exposes the database objects shown in the following table.
| Table/View | Name | Notes |
|---|---|---|
| Table | INPUT.AUDIENCE_SEGMENT_3PD |
Populate this table with segments that you want to upload for processing. |
| View | APP.VW_AUDIENCE_SEGMENT_RESULT_3PD |
Shows one entry, the latest, when entries on the INPUT.AUDIENCE_SEGMENT_3PD table are processed. |
| View | APP.VW_AUDIENCE_SEGMENT_RESULT_LOG_3PD |
If an existing row on the INPUT.AUDIENCE_SEGMENT_3PD table is updated, each version is a separate row in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG_3PD view. This shows history.For example, if an input row is changed once, it appears once in the APP.VW_AUDIENCE_SEGMENT_RESULT_3PD view and twice in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG_3PD view. |
When processing segments, the native app performs these steps:
- Checks authorization and validation.
- Uploads the records from the
INPUT.AUDIENCE_SEGMENT_3PDtable to The Trade Desk. - Adds a result that appears in the
APP.VW_AUDIENCE_SEGMENT_RESULT_3PDview with the sameRECORD_IDvalue as in theINPUT.AUDIENCE_SEGMENT_3PDrecord.
Sample input view
The following table shows a sample of third-party audience data in the INPUT.AUDIENCE_SEGMENT_3PD table.
NOTE: The table includes the following columns:
RECORD_ID,ID_TYPE,ID_VALUE,SEGMENT_NAME,DATA_PROVIDER_ID,TTL_IN_MINUTES,TIMESTAMP_UTC,LAST_UPDATED_ON_UTC. Because of the width, depending on your screen resolution, the table might wrap.
+-----------+------------+----------------------------------------------+------------------------+------------------+----------------+---------------+-------------------------+
| RECORD_ID | ID_TYPE | ID_VALUE | SEGMENT_NAME | DATA_PROVIDER_ID | TTL_IN_MINUTES | TIMESTAMP_UTC | LAST_UPDATED_ON_UTC |
+-----------+------------+----------------------------------------------+------------------------+------------------+----------------+---------------+-------------------------+
| 202 | TDID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 203 | UID2 | tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 204 | DAID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 205 | RampID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 206 | ID5 | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 207 | netID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 208 | FirstId | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 209 | email | user4554@example.com | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 210 | email_hash | tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 211 | phone | 1234567890 | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
| 212 | phone_hash | EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4= | native_app_seg_11.3.25 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 |
+-----------+------------+----------------------------------------------+------------------------+------------------+----------------+---------------+-------------------------+
Results view
The following table shows sample results in the APP.VW_AUDIENCE_SEGMENT_RESULT_3PD view.
NOTE: The table includes the following columns:
LOG_ID,RECORD_ID,ID_TYPE,ID_VALUE,SEGMENT_NAME,DATA_PROVIDER_ID,TTL_IN_MINUTES,TIMESTAMP_UTC,LAST_UPDATED_ON_UTC,PROCESSED_ON_UTC,IS_DELETE,IS_SUCCESS,ERROR_CODE,ERROR_MESSAGE,IS_DUPLICATE. Because of the width, depending on your screen resolution, the table might wrap.
+--------+-----------+------------------------------------------------+---------------------+------------------+----------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+--------------+
| LOG_ID | RECORD_ID | ID_TYPE | ID_VALUE | SEGMENT_NAME | DATA_PROVIDER_ID | TTL_IN_MINUTES | TIMESTAMP_UTC | LAST_UPDATED_ON_UTC | PROCESSED_ON_UTC | IS_DELETE | IS_SUCCESS | ERROR_CODE | ERROR_MESSAGE | IS_DUPLICATE |
+--------+-----------+------------------------------------------------+---------------------+------------------+----------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+--------------+
| 201 | 202 | TDID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 202 | 203 | DAID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 203 | 204 | RampID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 204 | 205 | ID5 | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 205 | 206 | netID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 206 | 207 | FirstId | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 207 | 201 | TDID | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 101 | 101 | TDID | 1364cfc8-8850-4fe4-93f2-8728ed4d0b2d | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 102 | 102 | TDID | 1889c638-af7c-4d35-82b6-8746f9a4bb15 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
| 103 | 103 | TDID | fd25b103-fd1f-48ce-9aef-512d6636982a | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | | FALSE |
+--------+-----------+------------------------------------------------+---------------------+------------------+----------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+--------------+
The following table shows sample results in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG_3PD view.
NOTE: The table includes the following columns:
LOG_ID,RECORD_ID,ID_TYPE,ID_VALUE,SEGMENT_NAME,DATA_PROVIDER_ID,TTL_IN_MINUTES,TIMESTAMP_UTC,LAST_UPDATED_ON_UTC,PROCESSED_ON_UTC,IS_DELETE,IS_SUCCESS,ERROR_CODE,ERROR_MESSAGE. Because of the width, depending on your screen resolution, the table might wrap.
+--------+-----------+---------+--------------------------------------+---------------------+------------------+----------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+
| LOG_ID | RECORD_ID | ID_TYPE | ID_VALUE | SEGMENT_NAME | DATA_PROVIDER_ID | TTL_IN_MINUTES | TIMESTAMP_UTC | LAST_UPDATED_ON_UTC | PROCESSED_ON_UTC | IS_DELETE | IS_SUCCESS | ERROR_CODE | ERROR_MESSAGE |
+--------+-----------+---------+--------------------------------------+---------------------+------------------+----------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+
| 15 | 15 | TDID | 59ee8049-988a-5df1-8575-0e1ee88eff1f | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 63 | 63 | TDID | 8e3d1da7-0275-495d-b48e-6a283fb2a2ec | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 4 | 4 | TDID | 1e2ebb25-f8b7-4e28-85f1-f6a9597e3ad5 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 40 | 40 | TDID | 2126d866-641d-4ba7-9e5c-8cf35ecf8b01 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 108 | 108 | TDID | f3a1175c-c225-41cb-8c09-bda280c2ff25 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 115 | 115 | TDID | 59ee8049-988a-5df1-8575-0e1ee88eff1f | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 174 | 174 | TDID | 1ba6d0b6-4a59-44b9-af44-812729a3fc4f | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 75 | 75 | TDID | 39f09669-d3c3-4ec8-88c7-5c6cbc7502d1 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 172 | 172 | TDID | c3ec5f4f-47b1-40b1-9752-c069e4f50325 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
| 7 | 7 | TDID | 3fb35bcb-c7c7-4c71-84d5-c8e0d44928c0 | native_app_seg_2025 | eltoromm | 91234 | | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE | TRUE | | |
+--------+-----------+---------+--------------------------------------+---------------------+------------------+----------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+
Stored procedures
For processing third-party audience segments, the native app provides several stored procedures. Follow these key guidelines:
- Do not process segments manually and run the segments task at the same time.
- You can trigger these operations either through the UI or by calling the applicable stored procedure.
- Run only one of the following operations at a time. Do not call the same stored procedure multiple times concurrently—for example, from multiple worksheets or parallel extract, transform, load (ETL) jobs. The following stored procedures must be run to completion before starting another:
APP.SP_START_SEGMENT_TASK_3PD()APP.SP_PROCESS_SEGMENTS_3PD(BATCH_SIZE INT, STOP_AFTER_SECONDS INT)For an example showing the SQL command syntax for processing segments manually, see Process unprocessed third-party audience segment records.
IMPORTANT: Violating these guidelines could lead to conflicts or inconsistent data.
The following table summarizes each procedure, its UI equivalent, and what it does.
| Procedure | UI Equivalent | Description |
|---|---|---|
APP.SP_PROCESS_SEGMENTS_3PD(BATCH_SIZE INT, STOP_AFTER_SECONDS INT) |
Select Process Immediately. | Processes BATCH_SIZE records in the INPUT.AUDIENCE_SEGMENT_3PD table immediately. After processing a batch, the procedure checks whether the STOP_AFTER_SECONDS value has elapsed, and does one of the following:
APP.SP_PROCESS_SEGMENTS_3PD again until all rows are processed. For details, see Process unprocessed third-party audience segment records. |
APP.SP_PRUNE_AUDIENCE_SEGMENT_RESULT_LOG_3PD(PRUNE_ERROR_LOGS BOOLEAN DEFAULT FALSE) |
None | Deletes historical result logs from the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG_3PD view. If the PRUNE_ERROR_LOGS property is FALSE, historical error results remain. If the PRUNE_ERROR_LOGS property is set to TRUE, the results are the following:
|
APP.SP_START_SEGMENT_TASK_3PD(); |
Select Start Task. | Starts a task that runs the APP.SP_PROCESS_SEGMENTS_3PD stored procedure whenever there are changes to the input table. The task is executed by the warehouse specified in the Permissions step of the app configuration. |
APP.SP_STOP_SEGMENT_TASK_3PD(); |
Select Stop Task. | Stops the task that runs the APP.SP_PROCESS_SEGMENTS_3PD stored procedure whenever there are changes to the input table, if the task is running. |
APP.SP_GET_SEGMENT_TASK_STATE_3PD(); |
View Task State. | Returns a value indicating whether the segment task is running. |
APP.SP_FORCE_RESET_SEGMENT_3PD_PIPELINE() |
None | Forces a reset, clearing the ingestion pipeline state. For details, see Using the force reset procedure. IMPORTANT: Use only as a last resort. |
Using the force reset procedure
The APP.SP_FORCE_RESET_SEGMENT_3PD_PIPELINE() stored procedure is a last-resort fix that clears out the ingestion pipeline state.
IMPORTANT: Use this only in scenarios where the pipeline is stuck and cannot make progress.
Here are some sample scenarios:
- Invalid or malformed data was inserted into the input table, causing the ingestion pipeline to fail repeatedly or throw exceptions.
- No new records are being ingested, and no new entries are appearing in the results table, even though data is incoming.
If you absolutely have to use this stored procedure, follow these steps.
IMPORTANT: Any rows that were present before executing this stored procedure, in the input table or the pipeline, will not be picked up for processing afterwards. After running the stored procedure, only newly inserted rows are picked up for processing.
- If there's any data in the input table that hasn't yet been processed, or is invalid or problematic, remove it.
- Run the
APP.SP_FORCE_RESET_SEGMENT_3PD_PIPELINE()stored procedure. - Insert new data into the
INPUT.AUDIENCE_SEGMENT_3PDtable for processing, or update theLAST_UPDATED_ON_UTCcolumn for existing data, after verifying that the data is not invalid or malformed.
Error messages
If you're processing third-party audience segments, you might see one or more of the error messages shown in the following table.
| Error Code | Error Message |
|---|---|
EmailOrPhoneNotAllowed |
The selected partner is not allowed to push email and phone data |
UID2NotAllowed |
The selected data provider is not allowed to push UID2 data for 3rd party data |
EUIDNotAllowed |
The selected partner is not allowed to push EUID data for 3rd party data |
Uid2Error |
Invalid identifier |
Unknown |
Data name should not be empty |
MissingUserId |
One of the following:
|
InvalidUserId |
One of the following:
|
HttpError |
HTTP error message |
Example SQL commands
The following sample SQL commands show how to complete specific activities relating to audience segments, using this native app.
IMPORTANT: As an initial test, use only one row of data. This can help verify that the end-to-end flow is functioning correctly, or reveal areas that need adjustment, before processing large volumes of data.
Insert records for an audience segment
The following sample shows the SQL command syntax for inserting records for an audience segment.
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate());
Replace the placeholders, SEGMENT_NAME_PLACEHOLDER and DATA_PROVIDER_ID_PLACEHOLDER, with your own values. For example:
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'native_app_seg_11.3.25', 'eltoromm', 91234, sysdate());
Insert multiple user IDs for an audience segment
The following sample shows the SQL command syntax for including multiple user IDs in an audience segment.
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('UID2', 'tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('DAID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('RampID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('ID5', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('FirstId', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('email', 'user4554@example.com', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('email_hash', 'tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('phone', '+1234567890', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate())
,('phone_hash', 'EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4=', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 91234, sysdate());
Replace the placeholders with your own values as shown in the previous example.
Process unprocessed third-party audience segment records
The following sample shows the SQL command syntax for processing unprocessed audience segment records. This example processes 1000 rows at a time in a loop, and stops looping if 180 seconds or more have elapsed:
call APP.SP_PROCESS_SEGMENTS_3PD(1000, 180);
Update segment records to extend TTL
The following sample shows the SQL command syntax for updating segment records to extend the TTL_IN_MINUTES value.
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 259200, sysdate());
Replace the placeholders, SEGMENT_NAME_PLACEHOLDER and DATA_PROVIDER_ID_PLACEHOLDER, with your own values. For example:
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'native_app_seg_11.3.25', 'eltoromm', 259200, sysdate());
Remove records from a segment
The following sample shows the SQL command syntax for removing records from a segment by setting the TTL_IN_MINUTES value to 0.
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 'DATA_PROVIDER_ID_PLACEHOLDER', 0, sysdate());
Replace the placeholders, SEGMENT_NAME_PLACEHOLDER and DATA_PROVIDER_ID_PLACEHOLDER, with your own values. For example:
insert into INPUT.AUDIENCE_SEGMENT_3PD (ID_TYPE, ID_VALUE, SEGMENT_NAME, DATA_PROVIDER_ID, TTL_IN_MINUTES, TIMESTAMP_UTC) values
('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'native_app_seg_11.3.25', 'eltoromm', 0, sysdate());
FAQs
The following is a list of commonly asked questions about the Snowflake Native App and processing third-party segments.
What's the difference between LAST_UPDATED_ON_UTC and TIMESTAMP_UTC?
These two fields serve different purposes in managing how data is processed and retained in your integration with The Trade Desk:
TIMESTAMP_UTCreflects when the event actually occurred.LAST_UPDATED_ON_UTCtriggers re-processing of the record. This can be useful in some circumstances—for example, in the following scenarios:- If you change any other field in the record, we recommend updating
LAST_UPDATED_ON_UTC, to help with troubleshooting. - If you want to force sending the record again, update
LAST_UPDATED_ON_UTC. One reason to do this is if a failure in processing has occurred, the underlying issue has been fixed, and you want to retry processing of the record.
- If you change any other field in the record, we recommend updating
Why can't I see all available procedures?
If you find that you cannot complete a key basic procedure, it's likely that you haven't been assigned the application role necessary to complete the task or procedure.
For example, if you don't have the APP_ADMIN application role, you might see the following error on trying to run the SP_START_SEGMENT_TASK task:
SQL compilation error: Unknown user-defined function APP.SP_START_SEGMENT_TASK.
If this happens, ask someone with the app owner's role (the role that installs the app) to assign the necessary application role to you.
For details, see Application roles.