Skip to content

ckljohn/trino-sql-table-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trino-sql-table-extractor

This extractor extract table names from Trino/Presto/Athena SQL by Trino native SQL parser.

I am not a Java developer. I just implement a stackoverflow answer (link) and take a frsyuki's repo (frsyuki/trino_sql_parser) as a reference to create this.

Build

./gradlew shadowJar

A jar file (trino-sql-table-extractor-x.x.x-all.jar) will be built under build/libs/

Usage

echo "with t1 as (select c from foo.bar) select * from t1" | java -jar <.jar path>

Integreation with Python

Require jnius

import jnius_config
jnius_config.set_classpath('<.jar path>')

from jnius import autoclass

main = autoclass('Main')

sql = "with t1 as (select c from foo.bar) select * from t1"
tables = main.getTables(sql).toArray()

print(tables)

About

Extract table names from Trino/Presto/Athena SQL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages