LineageRunner is the entry point for SQLLineage core processing logic. After parsing command-line options, a string representation of SQL statements will be fed to LineageRunner for processing. From a bird’s-eye view, it contains three steps:

  1. Calling sqlparse.parse function to parse string-base SQL statements into a list of sqlparse.sql.Statement

  2. Calling sqllineage.core.analyzer.LineageAnalyzer to analyze each sqlparse.sql.Statement and return a list of sqllineage.core.holders.StatementLineageHolder .

  3. Calling sqllineage.core.holders.SQLLineageHolder.of function to assemble the list of sqllineage.core.holders.StatementLineageHolder into one sqllineage.core.holders.SQLLineageHolder.

sqllineage.core.holders.SQLLineageHolder then will serve for lineage summary, in text or in visualization form.


class sqllineage.runner.LineageRunner(sql: str, encoding: Optional[str] = None, verbose: bool = False, draw_options: Optional[Dict[str, str]] = None)[source]

The entry point of SQLLineage after command line options are parsed.

  • sql – a string representation of SQL statements.

  • encoding – the encoding for sql string

  • verbose – verbose flag indicate whether statement-wise lineage result will be shown


Return str(self).

draw() None[source]

to draw the lineage directed graph

print_column_lineage() None[source]

print column level lineage to stdout

print_table_lineage() None[source]

print table level lineage to stdout


sqllineage.cli.main(args=None) None[source]

The command line interface entry point.


args – the command line arguments for sqllineage command