Skip to content

Backfill Runbook

When to Use

  • New seller onboarded - need historical data
  • Data gap discovered (missed nightly runs)
  • New data source added (need to populate retroactively)

Orders Backfill

cd ~/stickymetrics
python3 scripts/backfill_orders.py --seller ecomhd_us --days 365

Ads Backfill

Important: Each ad type has a lookback limit: - Sponsored Products (SP): 95 days - Sponsored Brands (SB): 60 days
- Sponsored Display (SD): 65 days

Requesting beyond these limits returns HTTP 400 with the exact retention cutoff date in the error body - parse it, don't hardcode.

Chunking rule: Pull in ≤31-day windows. The 900s poll timeout will expire on larger windows. Save the reportId for resume if timeout hits.

python3 scripts/pull_ad_spend.py --seller ecomhd_us --start-date 2026-01-01 --end-date 2026-01-31

Inventory Ledger

Monthly granularity. 60-day rolling window covers current + prior month:

python3 scripts/pull_inventory_ledger.py --seller ecomhd_us --days 60

After Backfill

Re-run forecast to incorporate new data:

python3 forecasts/forecast_all_lifecycle.py --seller ecomhd_us --horizon-days 365 --use-pretrained mini