I have:
res = db.engine.execute(\'select count(id) from sometable\')
The returned object is sqlalchemy.engine.result.ResultProxy
While the other answers work, SQLAlchemy provides a shortcut for scalar queries as ResultProxy.scalar():
count = db.engine.execute('select count(id) from sometable').scalar()
scalar()
fetches the first column of the first row and closes the result set, or returns None if no row is present. There's also Query.scalar(), if using the Query API.