generate directly from database