Python and SQL for Last-Scan Location History

Published 2026-04-05 by Faraz Rahimi

A single location field is a rumor. A short history of scans is a story you can debug.

Python and SQL for Last-Scan Location History

Tags: Python, SQL, Inventory, Warehouse, unlisted

I store scan events, not just current location. Item, bin, action, who, when. Current location is a view: the latest inbound, pick, or count event.

When something is "missing," I print the path. People argue less with a path.

Retention with a purpose

Forever events are expensive and nosy. I keep high-resolution history for a window that matches how disputes actually arise, then aggregate.

Write from the tools people already use

Scanner wedge, phone app, import job — they all insert into the same event table. If Excel can still overwrite current location without an event, the history is a lie.

Original post: https://farazrahimi.com/posts/python-and-sql-for-last-scan-location-history