unqualify_query {queryparser} | R Documentation |
Remove prefixes from column references in a parsed SQL query
Description
Unqualifies column references in the clauses of a parsed SQL
SELECT
statement that begin with any of the specified prefixes
followed by a dot
Usage
unqualify_query(tree, prefixes, except = character(0))
Arguments
tree |
a list returned by |
prefixes |
a character vector containing one or more table names or table aliases |
except |
a character vector containing column references to leave as is (optional) |
Details
In the returned list, the FROM
clause is unmodified and
column alias assignments made in the SELECT
clause are unmodified.
Value
A list the same as tree
but with all column references in the
SELECT
, WHERE
, GROUP BY
, HAVING
, and
ORDER BY
clauses unqualified, except those in except
See Also
Examples
my_query <- "SELECT f.flight,
manufacturer, p.model
FROM flights f
JOIN planes p USING (tailnum);"
unqualify_query(
parse_query(my_query),
prefixes = c("p", "f")
)
[Package queryparser version 0.3.2 Index]