-
I've run:
I want to extract the source and target table for each statement. Using the command line this is printed nicely, for example:
How can I extract this info cleanly from the Info: python3.7, sqllineage==1.1.4. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Since this is more of a "how-to" question, I converted this from issue to discussion. For your question, two options here:
import sqlparse
from sqllineage.runner import LineageRunner
for statement in sqlparse.split(sql):
result = LineageRunner(statement)
print(result.source_tables, result.target_tables)
# or if you want the text result, just print(result)
from sqllineage.runner import LineageRunner
result = LineageRunner(sql)
result._eval()
for lineage_result in result._lineage_results:
print(lineage_result.read, lineage_result.write, lineage_result.rename, lineage_result.drop, lineage_result.intermediate)
# or if you want the text result, just print(lineage_result) Let me know if you have further questions. |
Beta Was this translation helpful? Give feedback.
-
Amazing, thanks @reata! |
Beta Was this translation helpful? Give feedback.
Since this is more of a "how-to" question, I converted this from issue to discussion.
For your question, two options here: