QueryInspection
- class sqlcompyre.analysis.query_inspection.QueryInspection(engine: Engine, query: FromClause)[source]
Inspect the results of a SQL query.
- Note:
This class should never be initialized directly. Use the
inspect()orinspect_table()functions instead.
- Attributes:
- row_count
Get the number of rows returned by the query.
Methods
column_stats(column)Obtain statistics about a single column.
distinct_row_count(*columns)Get the number of rows with distinct values wrt.
- column_stats(column: str) ColumnStats[source]
Obtain statistics about a single column.
- Args:
column: The name of the column to obtain information about.
- Returns:
An object providing access to column statistics.
- distinct_row_count(*columns: str) int[source]
Get the number of rows with distinct values wrt. to the provided column(s).
- Args:
- columns: The set of columns to compute the number of distinct values for. If no
columns are provided, the number of distinct rows (across all columns) is computed.
- Returns:
The number of distinct rows.
- property row_count: int
Get the number of rows returned by the query.