-
Notifications
You must be signed in to change notification settings - Fork 31
Code changes #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Greeshma-03
wants to merge
3
commits into
main
Choose a base branch
from
Fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Code changes #83
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,36 +161,35 @@ def compute_ancestors( | |
map_entry_id_to_entry_type: Dict[str, str], | ||
) -> List[Dict[str, str]]: | ||
""" | ||
Build the ancestors array for an entry (using entry IDs). | ||
For each ancestor in the chain, construct its export resource using get_export_resource_by_id. | ||
If no belongs_to exists, assume the glossary is the only ancestor. | ||
Builds an ancestors array containing only the root glossary and the immediate parent. | ||
|
||
Args: | ||
child_id (str): The entry id of the child. | ||
parent_mapping (Dict[str, str]): The parent mapping. | ||
map_entry_id_to_entry_type (Dict[str, str]): The mapping of entry id to entry type. | ||
Returns: | ||
List[Dict[str, str]]: The ancestors array. | ||
List[Dict[str, str]]: The ancestors array with at most two elements. | ||
""" | ||
ancestors: List[Dict[str, str]] = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add Glossary adding logic here. |
||
if child_id in parent_mapping: | ||
current = parent_mapping[child_id] | ||
while True: | ||
current_type = map_entry_id_to_entry_type.get(current, "glossary") | ||
resource = get_export_resource_by_id(current, current_type) | ||
glossary_child_entry_name = f"{DATAPLEX_ENTRY_GROUP}/entries/{resource}" | ||
ancestors.append({"name": glossary_child_entry_name, "type": get_entry_type_name(current_type)}) | ||
if current not in parent_mapping: | ||
break | ||
current = parent_mapping[current] | ||
|
||
glossary_entry_name = ( | ||
f"{DATAPLEX_ENTRY_GROUP}/entries/projects/{PROJECT}/locations/{GLOSSARY_EXPORT_LOCATION}/glossaries/{GLOSSARY}" | ||
) | ||
ancestors.append({"name": glossary_entry_name, "type": get_entry_type_name("glossary")}) | ||
ancestors.reverse() | ||
return ancestors | ||
ancestors.append({ | ||
"name": glossary_entry_name, | ||
"type": get_entry_type_name("glossary") | ||
}) | ||
|
||
if child_id in parent_mapping: | ||
parent_id = parent_mapping[child_id] | ||
parent_type = map_entry_id_to_entry_type.get(parent_id, "glossary_category") | ||
resource = get_export_resource_by_id(parent_id, parent_type) | ||
parent_entry_name = f"{DATAPLEX_ENTRY_GROUP}/entries/{resource}" | ||
ancestors.append({ | ||
"name": parent_entry_name, | ||
"type": get_entry_type_name(parent_type) | ||
}) | ||
|
||
return ancestors | ||
|
||
def process_entry( | ||
entry: Dict[str, Any], | ||
|
@@ -486,6 +485,9 @@ def process_term_entry_links(entry: Dict[str, Any]) -> List[Dict[str, Any]]: | |
rel_url = f"https://datacatalog.googleapis.com/v2/{relative_resource_name}/relationships" | ||
response = api_call_utils.fetch_api_response(requests.get, rel_url, USER_PROJECT) | ||
logger.debug(f"Relationships response for {rel_url}: {response}") | ||
if not response or not response.get("json"): | ||
logger.warning(f"No relationships found for {relative_resource_name}") | ||
continue | ||
relationships = response.get("json", {}).get("relationships", []) | ||
|
||
for rel in relationships: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add context