inspectomop.results.Results¶
- class inspectomop.results.Results(cursor_result)¶
A cursor-like object with methods such as fetchone, fetchmany etc. that can be used to retrieve rows of results from query execution.
A subclass of sqlalchemy.engine.CursorResult that adds additional methods for retrieving query results as Pandas DataFrames.
See also
- __init__(cursor_result)¶
Methods
__init__(cursor_result)all()Return all rows in a sequence.
Return all rows from a results object as a pandas DataFrame
as_pandas_chunks(chunksize)Yields a pandas DataFrame with n_rows = chunksize
close()Close this
_engine.CursorResult.columns(*col_expressions)Establish the columns that should be returned in each row.
fetchall()A synonym for the
_engine.Result.all()method.fetchmany([size])Fetch many rows.
fetchone()Fetch one row.
first()Fetch the first row or
Noneif no row is present.freeze()Return a callable object that will produce copies of this
_engine.Resultwhen invoked.keys()Return an iterable view which yields the string keys that would be represented by each
_engine.Row.last_inserted_params()Return the collection of inserted parameters from this execution.
last_updated_params()Return the collection of updated parameters from this execution.
lastrow_has_defaults()Return
lastrow_has_defaults()from the underlyingExecutionContext.mappings()Apply a mappings filter to returned rows, returning an instance of
_engine.MappingResult.memoized_instancemethod(fn)Decorate a method memoize its return value.
merge(*others)Merge this
_engine.Resultwith other compatible result objects.one()Return exactly one row or raise an exception.
one_or_non()one_or_none()Return at most one result or raise an exception.
partitions([size])Iterate through sub-lists of rows of the size given.
postfetch_cols()Return
postfetch_cols()from the underlyingExecutionContext.prefetch_cols()Return
prefetch_cols()from the underlyingExecutionContext.scalar()Fetch the first column of the first row, and close the result set.
scalar_one()Return exactly one scalar result or raise an exception.
scalar_one_or_none()Return exactly one scalar result or
None.scalars()Return a
_engine.ScalarResultfiltering object which will return single elements rather than_row.Rowobjects.splice_horizontally(other)Return a new
CursorResultthat "horizontally splices" together the rows of thisCursorResultwith that of anotherCursorResult.splice_vertically(other)Return a new
CursorResultthat "vertically splices", i.e. "extends", the rows of thisCursorResultwith that of anotherCursorResult.supports_sane_multi_rowcount()Return
supports_sane_multi_rowcountfrom the dialect.supports_sane_rowcount()Return
supports_sane_rowcountfrom the dialect.tuples()Apply a "typed tuple" typing filter to returned rows.
unique([strategy])Apply unique filtering to the objects returned by this
_engine.Result.yield_per(num)Configure the row-fetching strategy to fetch
numrows at a time.Attributes
contextdialectcursorcursor_strategyconnectionclosedinserted_primary_keyReturn the primary key for the row just inserted.
inserted_primary_key_rowsReturn the value of
_engine.CursorResult.inserted_primary_keyas a row contained within a list; some dialects may support a multiple row form as well.is_insertTrue if this
_engine.CursorResultis the result of a executing an expression language compiled_expression.insert()construct.lastrowidReturn the 'lastrowid' accessor on the DBAPI cursor.
returned_defaultsReturn the values of default columns that were fetched using the
ValuesBase.return_defaults()feature.returned_defaults_rowsReturn a list of rows each containing the values of default columns that were fetched using the
ValuesBase.return_defaults()feature.returns_rowsTrue if this
_engine.CursorResultreturns zero or more rows.rowcountReturn the 'rowcount' for this result.
tApply a "typed tuple" typing filter to returned rows.