SQLAlchemy integration

It's probably fine to keep it this way for now; if the query API has a "native" way to handle the "delete orphaned rows" behavior of the second and third queries that might be best (the cascade functionality seems to have something for deleting orphans, but it seems designed for the other direction of the one-many link), since that's a bit hard to read, and for consistency. I guess it probably doesn't have a clause for RETURNING either, which would make the first one hard to replace cleanly.

I think it's fine to keep it how it is, unless sqlalchemy has some nice syntax sugar for the "delete orphaned rows" stuff, basically.