Extracts compact facts about a query: its shape, output projections, referenced relations, CTEs, set operations and star-projections.
Arguments
- sql
A single character string with one or more SQL statements (separated by
;).- dialect
Dialect used for parsing.
- schema
Optional schema specification (see
as_polyglot_schema()); improves resolution of unqualified or ambiguous columns.
Value
A polyglot_analysis object — a list with (among others):
shape— query shape (e.g."select","setOperation");projections— list of per-output-column facts (name, transform kind, upstream column references, type hints when aschemais given);relations— list of referenced relations with kind and alias;ctes,cteFacts— CTE names and per-CTE facts;setOperations,starProjections— when present.