# Target - Integration Specifications

## Target Sales

This is the pipeline for the Target Sales data. *Note that there's also the Target Inventory Pipeline.*

#### Raw Data

This pipeline incorperates two raw-data files:

* `retail.target_br_2yr_weekly_gm_tcin_loc` (the historical file)
* `retail.target_daily_sales_tcin_loc` (the current data)

#### Mappings

The mappings between the raw data and the final data are demonstrated in the following table.

**URS Sales Report**

| Source Field   | Destination Field             | Data Type      | Description |
| -------------- | ----------------------------- | -------------- | ----------- |
|                | sales\_report\_id \*          | VARCHAR(255)   |             |
| SALES\_DATE    | **sales\_date**               | DATE           |             |
| SALES\_DATE    | **source\_sales\_date**       | DATE           |             |
|                | location\_id \*               | VARCHAR(255)   |             |
|                | product\_id \*                | VARCHAR(255)   |             |
| SALE\_AMOUNT   | **dollar\_sales**             | DECIMAL(24,10) |             |
| SALE\_QUANTITY | **unit\_sales**               | DECIMAL(24,10) |             |
|                | original\_currency \*         | CHAR(3)        |             |
|                | currency\_conversion\_rate \* | DECIMAL(24,10) |             |
|                | converted\_currency \*        | CHAR(3)        |             |
|                | \_\_file\_name \*             | VARCHAR(255)   |             |
|                | \_\_source\_id \*             | VARCHAR(64)    |             |
|                | \_\_source\_display\_name \*  | VARCHAR(255)   |             |
|                | \_\_loaded\_at \*             | TIMESTAMP      |             |
|                | \_\_synced\_at \*             | TIMESTAMP      |             |

\* *Generated in the pipeline*

**URS Products**

| Source Field                                                                                 | Destination Field     | Data Type    | Description |
| -------------------------------------------------------------------------------------------- | --------------------- | ------------ | ----------- |
|                                                                                              | product\_id \*        | VARCHAR(255) |             |
| ITEM\_DESCRIPTION                                                                            | listing\_sku \*       | VARCHAR(255) |             |
| ITEM\_DESCRIPTION                                                                            | master\_sku \*        | VARCHAR(255) |             |
| "upc"                                                                                        | **reporting\_level**  | VARCHAR(255) |             |
| ITEM\_DESCRIPTION                                                                            | **product\_name**     | VARCHAR(255) |             |
| BARCODE                                                                                      | **upc**               | VARCHAR(255) |             |
| BRAND\_NAME                                                                                  | **brand\_name**       | VARCHAR(255) |             |
|                                                                                              | department            | VARCHAR(255) |             |
|                                                                                              | category              | VARCHAR(255) |             |
|                                                                                              | subcategory           | VARCHAR(255) |             |
|                                                                                              | product\_class        | VARCHAR(255) |             |
|                                                                                              | product\_type         | VARCHAR(255) |             |
| `concat( split_part(item_description, ' ', -2), ' ', split_part(item_description, ' ', -1))` | **product\_size**     | VARCHAR(255) |             |
| `split_part(item_description, ' ', -1)`                                                      | **unit\_of\_measure** | VARCHAR(255) |             |
|                                                                                              | pack\_count           | DECIMAL(0,6) |             |
|                                                                                              | \_\_file\_name \*     | VARCHAR(255) |             |
|                                                                                              | \_\_source\_id \*     | VARCHAR(64)  |             |
|                                                                                              | \_\_loaded\_at \*     | TIMESTAMP    |             |
|                                                                                              | \_\_synced\_at \*     | TIMESTAMP    |             |

\* *Generated in the pipeline*

**URS Locations**

|                                       |                          |              |             |
| ------------------------------------- | ------------------------ | ------------ | ----------- |
| `target_br_2yr_weekly_gm_tcin_loc`    | Destination Field        | Data Type    | Description |
|                                       | location\_id \*          | VARCHAR(255) |             |
| "Target"                              | **retailer\_name**       | VARCHAR(255) |             |
| platform.store\_locations.store\_name | **store\_name**          | VARCHAR(255) |             |
|                                       | market\_name             | VARCHAR(255) |             |
|                                       | warehouse\_name          | VARCHAR(255) |             |
|                                       | retailer\_division       | VARCHAR(255) |             |
| LOCATION\_ID                          | **retailer\_store\_id**  | VARCHAR(255) |             |
| platform.store\_locations.address     | **address1**             | VARCHAR(255) |             |
|                                       | address2                 | VARCHAR(255) |             |
| platform.store\_locations.city        | **city**                 | VARCHAR(255) |             |
| platform.store\_locations.state       | **state**                | VARCHAR(255) |             |
| platform.store\_locations.country     | **country**              | VARCHAR(255) |             |
| platform.store\_locations.zip\_code   | **zipcode**              | VARCHAR(255) |             |
| TRUE                                  | **is\_store\_level**     | BOOLEAN      |             |
| FALSE                                 | **is\_warehouse\_level** | BOOLEAN      |             |
| FALSE                                 | **is\_market\_level**    | BOOLEAN      |             |
|                                       | \_\_file\_name \*        | VARCHAR(255) |             |
|                                       | \_\_source\_id \*        | VARCHAR(64)  |             |
|                                       | \_\_loaded\_at \*        | TIMESTAMP    |             |
|                                       | \_\_synced\_at \*        | TIMESTAMP    |             |

\* *Generated in the pipeline*

**URS Specific to Target Sales**

The destination table that we map other Target metrics into is `urs.specific_to_target`. All of these should be available in the explore for this source.

```
    sales_report_id VARCHAR(255),
    vendor_id VARCHAR(255),
    barcode VARCHAR(255),
    tcin VARCHAR(255),
    dpci VARCHAR(255),
    manufacturer_style VARCHAR(255),
    dept VARCHAR(255),
    class VARCHAR(255),
    origination_channel VARCHAR(255),
    reporting_channel VARCHAR(255),
    fulfillment_type VARCHAR(255),
    drive_up_sale_a DECIMAL(24,10),
    drive_up_sale_q BIGINT,
    location_id VARCHAR(255),
    circular_sale_amount DECIMAL(24,10),
    circular_sale_quantity BIGINT,
    clearance_sale_amount DECIMAL(24,10),
    clearance_sale_quantity BIGINT,
    promo_sale_amount DECIMAL(24,10),
    promo_sale_quantity BIGINT,
    regular_sale_amount DECIMAL(24,10),
    regular_sale_quantity BIGINT,
    circle_sale_amount DECIMAL(24,10),
    circle_sale_quantity BIGINT,
    mature_sale_amount DECIMAL(24,10),
    mature_sale_quantity BIGINT,
    comparable_sale_amount DECIMAL(24,10),
    comparable_sale_quantity BIGINT,
    ad_comparable_sale_amount DECIMAL(24,10),
    ad_comparable_sale_quantity BIGINT,
    brand_id VARCHAR(255),
    return_guest_amount DECIMAL(24,10),
    return_guest_quantity BIGINT,
    shipt_app_sale_a DECIMAL(24,10),
    shipt_app_sale_q BIGINT,
    shipt_target_sale_a DECIMAL(24,10),
    shipt_target_sale_q BIGINT,
    __file_name VARCHAR(255),
    __source_id VARCHAR(64),
    __loaded_at TIMESTAMP,
    __synced_at TIMESTAMP
```

#### Pipeline architecture

This pipeline first brings in the historical data and transforms it, inserting it into URS schema. Then the pipeline runs for the regular extracts. In both cases, we join to `platform.store_locations` to bring in store level data.


---

# 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://help.daasity.com/core-concepts/data-integrations/setup-guides/retail-integrations/target-daily-sales-+-historical-sales/target-integration-specifications.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.
