Autocomplete with Python, Pylons, SQLAlchemy and jQuery

Recently I needed to implement my own autocomplete for a project on snagmachine.com. We had a large database of products and wanted to ease data entry by hinting to the user via autocomplete when possible.

In future, we can probably just use Freebase Suggest but right now we needed our own solution.
The Pieces
Autocomplete is not [...]

Freebase Suggest and restricting to multiple types

Freebase Suggest is a little JavaScript (and jQuery) widget for adding Freebase’s auto-complete and search API reconciliation features to any of your text boxes. While this might sound a bit strange or pointless initially, its actually incredibly useful in many applications
Imagine you are running a site for your own music reviews. [...]