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
Convert a dlt.Schema
to a a Graphviz DOT string and return its value.
Arguments:
schema
- dlt schema to convertinclude_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 fromchild._dlt_parent_id
toparent._dlt_id
include_root_child_ref
- If True, include references fromchild._dlt_root_id
toroot._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
Render a visualization of the dlt.Schema
.
Arguments:
obj
-dlt.Schema
or object with adlt.Schema
attached.path
- file path for the rendered visualization. The render format is inferred from the file extension iffile_format
is unspecified.format
- If specified, it will be used by the graphviz renderer and be appended to thepath
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 excludesformat
andcleanup
which respectively matchformat_
andnot 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 fromchild._dlt_parent_id
toparent._dlt_id
include_root_child_ref
- If True, include references fromchild._dlt_root_id
toroot._dlt_id
group_by_resource
- If True, group tables by resource into a subcluser.
Returns:
File path of the rendered dlt schema visualization.