@classmethod<EOL><INDENT>def by_sql(cls, sql, engine_or_session):<DEDENT>
ses, auto_close = ensure_session(engine_or_session)<EOL>result = ses.query(cls).from_statement(sql).all()<EOL>if auto_close:<EOL><INDENT>ses.close()<EOL><DEDENT>return result<EOL>
Query with sql statement or texture sql.

:type sql: Union[Select, TextClause]
:type engine_or_session: Union[Engine, Session]