Select data from the table defined by a ORM class, and put into prettytable

    :param orm_class: an orm class inherit from
        ``sqlalchemy.ext.declarative.declarative_base()``

    :type engine_or_session: Union[Engine, Session]
    :param engine_or_session: the engine or session used to execute the query.

    :type limit: int
    :param limit: int, limit rows to return.

    :rtype: PrettyTable

    **中文文档**

    将数据对象的数据放入 PrettyTable 中.

    常用于快速预览某个对象背后的数据.

def from_object(orm_class, engine_or_session, limit=None, **kwargs):
    """
    Select data from the table defined by a ORM class, and put into prettytable

    :param orm_class: an orm class inherit from
        ``sqlalchemy.ext.declarative.declarative_base()``

    :type engine_or_session: Union[Engine, Session]
    :param engine_or_session: the engine or session used to execute the query.

    :type limit: int
    :param limit: int, limit rows to return.

    :rtype: PrettyTable

    **中文文档**

    将数据对象的数据放入 PrettyTable 中.

    常用于快速预览某个对象背后的数据.
    """

    ses, auto_close = ensure_session(engine_or_session)
    query = ses.query(orm_class)
    if limit is not None:
        query = query.limit(limit)
    result_proxy = execute_query_return_result_proxy(query)
    if auto_close:
        ses.close()
    return from_db_cursor(result_proxy.cursor)