workaround for incorrect SQL generated by pewee