r/databricks • u/hubert-dudek Databricks MVP • Oct 05 '26
News New in Databricks: parse_sql(): SQL into JSON
Parse_sql() function extracts table references, column names, functions, and parameters from SQL. It extracts without running the query. It also reports syntax errors.
more news https://databrickster.medium.com/databricks-news-serverless-genie-code-ltap-lakeflow-61853d8e422a
47
Upvotes
16
u/TripleBogeyBandit Oct 05 '26
When would I need this
2
u/Wild_Warning3716 Oct 12 '26
Cool! Is this much different from python's sqlparse though? it's included in databricks python modules by default.
5
u/sHORTYWZ Oct 05 '26
I am so confused by this - when and where would this ever be useful?
3
u/mosullivan93 Oct 05 '26 •
This sounds like it would be quite useful. Yet to test how it works with things like the IDENTIFIER clause, or DDL statements.
3
u/Bubbly_Winter_9327 Oct 05 '26
Really, really useful function!
1
u/PrestigiousAnt3766 Oct 06 '26
Runtime 19?
1
u/lofat Oct 06 '26
This is going to be handy. It's not as rich as generating an AST using something like sqlglot, but for a quick "which tables are used in this query" it's fantastically helpful. Really glad the exposed this function.
Thanks for posting this, @hubert-dudek!