dlt.helpers.dbml
schema_to_dbml
def schema_to_dbml(schema: TStoredSchema,
*,
allow_custom_dbml_properties: bool = False,
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) -> Database
Convert a dlt.Schema object to a PyDBML representation.
Arguments:
schema
- dlt schema to convertallow_custom_dbml_properties
- If True, store all dlt metadata on DBML properties. This will cause rendering errors in most DBML frontends. If True, dlt to DBML all metadata is preserved. If False, the conversion loses some details to reconstruct the dlt schema.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.
Returns:
DBML schema
export_to_dbml
@overload
def export_to_dbml(schema: dlt.Schema, *, path: None = None) -> str
Convert dlt.Schema
to DBML and return the string
export_to_dbml
@overload
def export_to_dbml(schema: dlt.Schema, *, path: Union[pathlib.Path,
str]) -> str
Convert dlt.Schema
to DBML and write result to path at specified path
export_to_dbml
def export_to_dbml(schema: dlt.Schema,
*,
path: Optional[Union[pathlib.Path, str]] = None,
allow_custom_dbml_properties: bool = False,
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 DBML string and return its value.
Arguments:
schema
- dlt schema to convertpath
- If specified, write the DBML string to the file at the specified path.allow_custom_dbml_properties
- If True, store all dlt metadata on DBML properties. This will cause rendering errors in most DBML frontends. If True, dlt to DBML all metadata is preserved. If False, the conversion loses some details to reconstruct the dlt schema.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.
Returns:
DBML string