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 sqllineage.utils.helpers.split function to split string-base SQL statements into a list of str statement.

  2. Calling sqllineage.core.analyzer.LineageAnalyzer to analyze each one statement sql string 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, dialect: str = 'non-validating', encoding: str | None = None, verbose: bool = False, draw_options: Dict[str, str] | None = 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(dialect: str) 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