| sql_annotate_types | R Documentation |
Runs upstream type inference over the AST. With a schema, column
references resolve to their declared types; without one, only types that
can be inferred from literals, casts and function signatures are filled.
sql_annotate_types(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_ast object whose nodes carry an inferred_type field
where a type could be determined. Pass it to sql_generate() to render,
or inspect $statements directly.
ast <- sql_annotate_types(
"SELECT id + 1 AS next_id FROM t",
schema = list(t = c(id = "INT"))
)
# the Add node now carries inferred_type INT
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.