formatter: moved db API to sqlalchemy