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

# obt_shipments

> One row per shipped Shopify parcel with carrier, tracking, delivery leg times, and optional warehouse hand-off timestamps.

One row per successful, shipping-required Shopify fulfillment (a parcel), for Shopify stores whose orders SourceMedium's Shopify connector fully serves. Other stores have no rows.

* **Grain:** One row per (`sm_store_id`, `fulfillment_id`).
* **Date fields:** `order_created_at`, `fulfillment_created_at`, `in_transit_at`, `delivered_at`, and warehouse timestamps (`sent_to_warehouse_at`, `picked_at`, `packed_at`, `warehouse_shipped_at`) when matched.
* **Filters to start with:** `is_order_sm_valid = TRUE` to match revenue and order metrics (parcels for zero-dollar exchange or replacement orders are kept in the table and flagged FALSE).
* **Joins:** Join [`obt_orders`](https://docs.sourcemedium.com/docs/data-activation/data-tables/sm_transformed_v2/obt_orders) on `sm_order_key` for order revenue, customer, and channel attributes.

## When to use this table

Use `obt_shipments` to measure parcel-level fulfillment and carrier performance: click-to-door time, carrier hand-off delays, transit times by carrier or fulfilling location, late deliveries relative to carrier estimates, and warehouse pick/pack/ship times when a warehouse system (such as [Pipe17](https://docs.sourcemedium.com/docs/data-inputs/platform-integration-instructions/pipe17-integration.md)) is connected.

For order-level open fulfillment queues, see [`rpt_shopify_order_fulfillment`](https://docs.sourcemedium.com/docs/data-activation/data-tables/sm_transformed_v2/rpt_shopify_order_fulfillment) and [`rpt_fulfillment_backlog_daily`](https://docs.sourcemedium.com/docs/data-activation/data-tables/sm_transformed_v2/rpt_fulfillment_backlog_daily).

## Reading the columns

* **Leg durations:** Each duration column (`order_to_fulfillment_hours`, `fulfillment_to_in_transit_hours`, `in_transit_to_delivered_hours`, `order_to_delivered_hours`, `sent_to_warehouse_to_shipped_hours`) is NULL unless both timestamps exist and are in order. Recent cohorts look artificially fast until their slower parcels deliver, so leave a buffer window before comparing recent weeks.
* **Warehouse enrichment:** When you connect a warehouse system (currently Pipe17), SourceMedium matches each Shopify parcel on its tracking numbers. `warehouse_match_status` reports the match outcome (`matched`, `ambiguous`, `not_found`, `no_tracking_number`, or `no_warehouse_system`). Warehouse fields (`warehouse_system`, `warehouse_request_id`, `sent_to_warehouse_at`, `picked_at`, `packed_at`, `warehouse_shipped_at`, `warehouse_shipping_class`, and `sent_to_warehouse_to_shipped_hours`) are populated only when `warehouse_match_status = 'matched'`.
* **Freshness:** `fulfillments_synced_at` shows the latest Shopify fulfillment sync time reflected in the row.

## Example: median click-to-door hours by carrier

```sql theme={null}
SELECT
  carrier_name,
  COUNT(*) AS delivered_parcels,
  ROUND(APPROX_QUANTILES(order_to_delivered_hours, 100)[OFFSET(50)], 1) AS median_click_to_door_hours,
  ROUND(APPROX_QUANTILES(in_transit_to_delivered_hours, 100)[OFFSET(50)], 1) AS median_transit_hours
FROM `your_project.sm_transformed_v2.obt_shipments`
WHERE sm_store_id = 'your-sm_store_id'
  AND is_order_sm_valid = TRUE
  AND delivered_at IS NOT NULL
  AND DATE(order_created_at) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 45 DAY) AND DATE_SUB(CURRENT_DATE(), INTERVAL 14 DAY)
GROUP BY carrier_name
ORDER BY delivered_parcels DESC
```

## Columns

| Column | Type | Description |
| - | - | - |
| `sm_order_key` | STRING | SourceMedium order key; joins obt\_orders. |
| `sm_store_id` | STRING | SourceMedium store identifier. |
| `carrier_name` | STRING | Carrier family normalized from tracking\_company (FedEx, UPS, USPS, DHL eCommerce, Amazon, ...). A name whose carrier is not certain passes through unchanged. |
| `delivered_at` | TIMESTAMP | Delivery carrier event Shopify recorded. |
| `delivered_vs_estimate_hours` | FLOAT64 | Delivery minus the latest carrier estimate, in hours; negative is early. |
| `estimated_delivery_at` | TIMESTAMP | Latest carrier delivery estimate Shopify recorded. |
| `fulfillment_created_at` | TIMESTAMP | Fulfillment creation, usually when the 3PL bought the label. |
| `fulfillment_display_status` | STRING | Shopify's latest shipment status for the parcel, as Shopify returns it (for example CONFIRMED for a label with no carrier scan yet, IN\_TRANSIT, OUT\_FOR\_DELIVERY, ATTEMPTED\_DELIVERY, DELAYED, NOT\_DELIVERED, DELIVERED). |
| `fulfillment_id` | STRING | Shopify fulfillment identifier. |
| `fulfillment_location_id` | STRING | Shopify location that fulfilled the parcel. |
| `fulfillment_location_name` | STRING | Name of that location (for example a 3PL warehouse). |
| `fulfillment_name` | STRING | Shopify fulfillment name (order name and sequence). |
| `fulfillment_service_name` | STRING | Shopify fulfillment service that created the fulfillment, when one did. |
| `fulfillment_to_in_transit_hours` | FLOAT64 | Hours from fulfillment creation to the first in-transit event (carrier hand-off). |
| `fulfillment_total_quantity` | INT64 | Units in the fulfillment. |
| `fulfillments_synced_at` | TIMESTAMP | Latest sync time of the store's Shopify fulfillments read by this build. Statuses and timestamps reflect Shopify updates through this time. |
| `in_transit_at` | TIMESTAMP | First in-transit carrier event Shopify recorded. |
| `in_transit_to_delivered_hours` | FLOAT64 | Hours in transit, from the first in-transit event to delivery. |
| `is_order_cancelled` | BOOL | True when the order was later cancelled. The parcel still shipped. |
| `is_order_sm_valid` | BOOL | The order's SourceMedium validity flag from obt\_orders. False for zero-dollar exchange or replacement orders and other orders kept out of revenue. |
| `order_created_at` | TIMESTAMP | Time the order was created. |
| `order_id` | STRING | Shopify order identifier. |
| `order_name` | STRING | Customer-facing order reference. |
| `order_to_delivered_hours` | FLOAT64 | Hours from order creation to delivery (click to door). |
| `order_to_fulfillment_hours` | FLOAT64 | Hours from order creation to fulfillment creation. |
| `packed_at` | TIMESTAMP | Time the warehouse packed the request, as the warehouse system recorded it. |
| `picked_at` | TIMESTAMP | Time the warehouse picked the request, as the warehouse system recorded it. |
| `sent_to_warehouse_at` | TIMESTAMP | Time the warehouse system sent the request to the warehouse. |
| `sent_to_warehouse_to_shipped_hours` | FLOAT64 | Hours from the warehouse system sending the request to the warehouse to the warehouse shipping it. |
| `source_system` | STRING | Commerce platform for the order. |
| `tracking_company` | STRING | Carrier name as the store or its 3PL recorded it. |
| `tracking_number` | STRING | First tracking number on the fulfillment. |
| `tracking_number_count` | INT64 | Tracking numbers on the fulfillment. |
| `warehouse_match_status` | STRING | How the parcel matched a warehouse system's records on its tracking numbers: matched (one request), ambiguous (its numbers name more than one request), not\_found, no\_tracking\_number, or no\_warehouse\_system (the store's warehouse does not report through a connected system). |
| `warehouse_request_id` | STRING | The warehouse system's request (hand-off to the warehouse) that shipped the parcel. |
| `warehouse_shipped_at` | TIMESTAMP | Time the warehouse shipped the request, as the warehouse system recorded it (the parcel's ship date when the request has none). |
| `warehouse_shipping_class` | STRING | Shipping service class the warehouse system recorded (for example Ground or Two Day). |
| `warehouse_system` | STRING | Warehouse system the parcel matched (for example pipe17). |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.