Write our own SQL generator