google / google/googlesql

Extract created table/view table name without building table catalog

Open
#53 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.6k
Forks
260
PR merge metrics
No merged PRs in 30d

Description

Hi.

I am looking for a way to extract the table/view name from table/view create statements without building a table catalog and analyzing the statement.

For example, consider the following:
```
String sql = "create or replace table project2.dataset2.table2 as SELECT column1 from project1.dataset1.table1";
List> tables = Analyzer.extractTableNamesFromStatement(sql, ZetaSqlAnalyzerFactory.getAnalyzerOptions());
```
With the above, I am able to retrieve the names of the tables involved in the query, in this case `project1.dataset1.table1`. What I am looking for is how to extract the created table `project2.dataset2.table2` without building the table catalog and analyzing the statement. I can retrieve them building a table catalog and analyzing the statement, my issue is that I am not always able to build the table catalog, so I am looking for a way to bypass this step.

Best regards

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.