sql_source_tables: List source tables referenced by SQL

View source: R/analysis.R

sql_source_tablesR Documentation

List source tables referenced by SQL

Description

Returns the physical tables a query reads from, across all statements. CTE names are not included (they are intermediate results, not sources).

Usage

sql_source_tables(sql, dialect = "generic")

Arguments

sql

A single character string with one or more SQL statements (separated by ⁠;⁠).

dialect

Dialect used for parsing.

Value

A character vector of table names, in order of first appearance.

Examples

sql_source_tables("SELECT * FROM a JOIN b ON a.id = b.id")
sql_source_tables("WITH x AS (SELECT 1 FROM t) SELECT * FROM x")

polyglotSQL documentation built on Sept. 27, 2026, 5:06 p.m.