| sql_analyze | R Documentation |
Extracts compact facts about a query: its shape, output projections, referenced relations, CTEs, set operations and star-projections.
sql_analyze(sql, dialect = "generic", schema = NULL)
sql |
A single character string with one or more SQL statements
(separated by |
dialect |
Dialect used for parsing. |
schema |
Optional schema specification (see |
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 a schema is given);
relations — list of referenced relations with kind and alias;
ctes, cteFacts — CTE names and per-CTE facts;
setOperations, starProjections — when present.
a <- sql_analyze("WITH x AS (SELECT id FROM t) SELECT x.id, 2 AS two FROM x")
a$shape
vapply(a$projections, function(p) p$name, character(1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.