Skip to main content
Every enriched view includes a last_updated column that reflects the most recent modification timestamp across all source tables contributing to that record. Use this column to build efficient incremental pipelines rather than full-refreshing your downstream tables.

How last_updated Works

The last_updated timestamp is computed as the GREATEST of all related source table timestamps. For example, an orders_enriched record’s last_updated reflects changes to the order itself, its shipping address, payment intent, order items, refunds, and transfers. This means a record’s last_updated will advance if any related entity is modified, even if the order record itself hasn’t changed. A typical incremental pattern maintains a timestamp represented the latest record and pulls only records modified since the last successful load.

Handling Deletes

Records are soft-deleted. The is_deleted column indicates whether a record has been removed. Deleted records remain in the view with is_deleted = TRUE, so your incremental pipeline will pick them up through the normal last_updated mechanism. To exclude deleted records in your analytics:
SELECT *
FROM orders_enriched
WHERE is_deleted = FALSE;
The data share refreshes every 6 hours.

Initial Full Load

For your first load, omit the last_updated filter to pull all historical data:
CREATE TABLE your_local_orders AS
SELECT *
FROM VETCOVE_DATA.PHD_ENRICHED.ORDERS_ENRICHED;
Then switch to the incremental pattern for subsequent loads.

Monitoring Data Freshness

To verify you’re receiving current data, check the maximum last_updated across key tables:
SELECT
    'clinic_enriched' AS view_name, MAX(last_updated) AS latest_update FROM clinic_enriched
UNION ALL
SELECT 'orders_enriched', MAX(last_updated) FROM orders_enriched
UNION ALL
SELECT 'patient_enriched', MAX(last_updated) FROM patient_enriched
UNION ALL
SELECT 'invoice_enriched', MAX(last_updated) FROM invoice_enriched
ORDER BY latest_update DESC;