from:https://segmentfault.com/q/1010000000140472 filter: apply the given filtering criterion to a copy of this Query, using SQL expressions.e.g.:session.query(MyClass).filter(MyClass.name == 'some name') filter_by: apply the given filtering criterion…