Database API

For those who want to write their own scripts...