Share code between sql an nupy computation.

Fixes display of class colors on sql data.