Skip to main content

Common utilities

Class
📁application_sdk.transformers.common.utils

Utility 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) -> str
Processes 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
textstr
Required
The text to process and sanitize
max_lengthint
Optional
Maximum length to keep (default: 100000)
Default:100000
Returns
str - Processed and sanitized text that is JSON-safe
Example
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) -> str
Builds qualified names for Atlas entities by combining connector qualified name with path components. Creates hierarchical qualified names following Atlas naming conventions.
Parameters
connector_qualified_namestr
Required
The base qualified name for the connector (e.g., 'tenant/connector/1')
Example:tenant/connector/1
*path_componentsstr
Required
Variable number of path components to append (e.g., 'database', 'schema', 'table')
Example:databaseschematable
Returns
str - Fully qualified name for the Atlas entity
Example
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]
Optional
Path to custom template directory. If provided, custom templates take precedence over default templates.
Example:/path/to/custom/templates
assetsOptional[List[str]]
Optional
List of asset types to include in the mapping. If not provided, all available asset types are included.
Example:TABLECOLUMNDATABASE
Returns
Dict[str, str] - Dictionary mapping asset type names to their YAML template file paths
Example
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