def get_rows_fieldnames_from_raw_sql(
        session: Union[Session, Engine, Connection],
        sql: str) -> Tuple[Sequence[Sequence[Any]], Sequence[str]]:
    """
    Returns results and column names from a query.

    Args:
        session: SQLAlchemy :class:`Session`, :class:`Engine`, or
            :class:`Connection` object
        sql: raw SQL to execure

    Returns:
        ``(rows, fieldnames)`` where ``rows`` is the usual set of results and
        ``fieldnames`` are the name of the result columns/fields.

    """
    result = session.execute(sql)  # type: ResultProxy
    fieldnames = result.keys()
    rows = result.fetchall()
    return rows, fieldnames
def get_rows_fieldnames_from_raw_sql ( session : Union [ Session , Engine , Connection ] , sql : str ) -> Tuple [ Sequence [ Sequence [ Any ] ] , Sequence [ str ] ] : result = session . execute ( sql ) fieldnames = result . keys ( ) rows = result . fetchall ( ) return rows , fieldnames
Returns results and column names from a query.

    Args:
        session: SQLAlchemy :class:`Session`, :class:`Engine`, or
            :class:`Connection` object
        sql: raw SQL to execure

    Returns:
        ``(rows, fieldnames)`` where ``rows`` is the usual set of results and
        ``fieldnames`` are the name of the result columns/fields.