Runner

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 statements.

  2. Calling sqllineage.core.analyzer.LineageAnalyzer to analyze each one statement sql string. Get 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.

sqllineage.runner.LineageRunner

class sqllineage.runner.LineageRunner(sql: str, dialect: str = 'ansi', metadata_provider: ~sqllineage.core.metadata_provider.MetaDataProvider = <sqllineage.core.metadata.dummy.DummyMetaDataProvider object>, verbose: bool = False, silent_mode: bool = False, draw_options: ~typing.Dict[str, str] | None = None)[source]

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

Parameters:
  • sql – a string representation of SQL statements.

  • dialect – sql dialect

  • metadata_provider – metadata service object providing table schema

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

  • silent_mode – boolean flag indicating whether to skip lineage analysis for unknown statement types

__str__(**kwargs)[source]

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

static supported_dialects() Dict[str, List[str]][source]

an ordered dict (so we can make sure the default parser implementation comes first) with key, value as parser_name, dialect list respectively

sqllineage.cli.main

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

The command line interface entry point.

Parameters:

args – the command line arguments for sqllineage command