to abstract away the exact SQL db that sako is using underneath all, we could use a SQL builder package.
sako
e.g.: