Common utilities
Class📁
application_sdk.transformers.common.utilsUtility functions for common transformer operations including text processing, qualified name building, and YAML template path mapping. These functions are used by transformers to handle common tasks like sanitizing text, building Atlas qualified names, and managing template paths.
Methods3
▸
process_text
static
process_text(text: str, max_length: int = 100000) -> strProcesses and sanitizes text for storage in Atlas entities. Truncates text to maximum length, removes HTML tags, normalizes whitespace, and returns a JSON-safe string.
Parameters
textstrThe text to process and sanitize
max_lengthintMaximum length to keep (default: 100000)
100000Returns
str - Processed and sanitized text that is JSON-safeExample
from application_sdk.transformers.common.utils import process_text
cleaned_text = process_text(raw_text, max_length=100000)
# Text is truncated, HTML tags removed, whitespace normalized
▸
build_atlas_qualified_name
static
build_atlas_qualified_name(connector_qualified_name: str, *path_components: str) -> strBuilds qualified names for Atlas entities by combining connector qualified name with path components. Creates hierarchical qualified names following Atlas naming conventions.
Parameters
connector_qualified_namestrThe base qualified name for the connector (e.g., 'tenant/connector/1')
tenant/connector/1*path_componentsstrVariable number of path components to append (e.g., 'database', 'schema', 'table')
databaseschematableReturns
str - Fully qualified name for the Atlas entityExample
from application_sdk.transformers.common.utils import build_atlas_qualified_name
qualified_name = build_atlas_qualified_name(
"tenant/connector/1",
"database",
"schema",
"table"
)
# Returns: "tenant/connector/1/database/schema/table"
▸
get_yaml_query_template_path_mappings
static
get_yaml_query_template_path_mappings(custom_templates_path: Optional[str] = None, assets: Optional[List[str]] = None) -> Dict[str, str]Gets mappings of asset types to YAML template file paths. Returns a dictionary mapping entity type names to their corresponding YAML template file paths, supporting both default and custom template directories.
Parameters
custom_templates_pathOptional[str]Path to custom template directory. If provided, custom templates take precedence over default templates.
/path/to/custom/templatesassetsOptional[List[str]]List of asset types to include in the mapping. If not provided, all available asset types are included.
TABLECOLUMNDATABASEReturns
Dict[str, str] - Dictionary mapping asset type names to their YAML template file pathsExample
from application_sdk.transformers.common.utils import get_yaml_query_template_path_mappings
mappings = get_yaml_query_template_path_mappings(
custom_templates_path="/path/to/templates",
assets=["TABLE", "COLUMN", "DATABASE"]
)
# Returns: {
# "TABLE": "/path/to/templates/table.yaml",
# "COLUMN": "/path/to/templates/column.yaml",
# "DATABASE": "/path/to/templates/database.yaml"
# }
See also
- Transformers: Overview of transformer interface and implementations
- Query-based transformer: Transformer that uses YAML templates for metadata transformation
- Atlas transformer: Transformer that converts metadata using pyatlan library classes