U/salnikov/dm 621

I'll need to look at it, I think it may be useful to unify all access to mysql via `db` module but I'm not sure yet that it does everything that this script needs.