def get_entry_link_id()

in dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/bg_import/business_glossary_export_v2.py [0:0]


def get_entry_link_id(relationship_name: str) -> str:
    """Extracts the id from the full relationship name."""
    # Since relationships are bi-directional, we need to ensure the same entry link ID is used if the relationship involves two glossaries.
    # This ensures that during export and subsequent import, the entry link ID remains consistent for the same relationship.
    match = re.search(r"projects/[^/]+/locations/[^/]+/entryGroups/[^/]+/entries/[^/]+/relationships/(.+)$", relationship_name)
    if match:
        return match.group(1)
    return ""