Skip to main content
Version: devel

dlt.helpers.graphviz

Build a graphviz graph representation using raw strings to avoid dependency on graphviz

schema_to_graphviz

def schema_to_graphviz(schema: TStoredSchema,
*,
include_dlt_tables: bool = True,
include_internal_dlt_ref: bool = True,
include_parent_child_ref: bool = True,
include_root_child_ref: bool = True,
group_by_resource: bool = False) -> str

View source on GitHub

Convert a dlt.Schema to a a Graphviz DOT string and return its value.

Arguments:

  • schema - dlt schema to convert
  • include_dlt_tables - If True, include data tables and internal dlt tables. This will influence table references and groups produced.
  • include_internal_dlt_ref - If True, include references between tables _dlt_version, _dlt_loads and _dlt_pipeline_state
  • include_parent_child_ref - If True, include references from child._dlt_parent_id to parent._dlt_id
  • include_root_child_ref - If True, include references from child._dlt_root_id to root._dlt_id
  • group_by_resource - If True, group tables by resource and create subclusters.

Returns:

A DOT string of the schema

render_schema_with_graphviz

def render_schema_with_graphviz(
obj: Union[dlt.Schema, TStoredSchema, dlt.Pipeline, dlt.Dataset],
*,
path: Union[pathlib.Path, str],
format_: Optional[str] = None,
save_dot_file: bool = False,
render_kwargs: Optional[dict[str, Any]] = None,
include_dlt_tables: bool = True,
include_internal_dlt_ref: bool = True,
include_parent_child_ref: bool = True,
include_root_child_ref: bool = True,
group_by_resource: bool = False) -> pathlib.Path

View source on GitHub

Render a visualization of the dlt.Schema.

Arguments:

  • obj - dlt.Schema or object with a dlt.Schema attached.
  • path - file path for the rendered visualization. The render format is inferred from the file extension if file_format is unspecified.
  • format - If specified, it will be used by the graphviz renderer and be appended to the path value.
  • save_dot_file - If True, this function will output the content of the DOT string to a file. The DOT file allows to rerender the visualization. It can be useful to version it since it produces meaningful diffs. The DOT file is produced even if rendering fails, which can help debugging.
  • render_kwargs - Dictionary of kwargs to pass to the Graphviz method .render(). This excludes format and cleanup which respectively match format_ and not save_dot_file.
  • include_dlt_tables - If True, include data tables and internal dlt tables. This will influence table references and groups produced.
  • include_internal_dlt_ref - If True, include references between tables _dlt_version, _dlt_loads and _dlt_pipeline_state
  • include_parent_child_ref - If True, include references from child._dlt_parent_id to parent._dlt_id
  • include_root_child_ref - If True, include references from child._dlt_root_id to root._dlt_id
  • group_by_resource - If True, group tables by resource into a subcluser.

Returns:

File path of the rendered dlt schema visualization.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.