Skip to content
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

query_by_wiql throws exception #510

Open
partmachine opened this issue Oct 30, 2024 · 0 comments
Open

query_by_wiql throws exception #510

partmachine opened this issue Oct 30, 2024 · 0 comments

Comments

@partmachine
Copy link

query_by_wiql throws exception:

'Unable to build a model: ("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'")), DeserializationError: ("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'"))', DeserializationError("Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no attribute 'get'")))

I'm trying to get a list of backlog items ids using the following function:

def get_backlog_item_ids(self, project_name, item_type="Product Backlog Item"):
try:
work_item_tracking_client = self.connection.clients.get_work_item_tracking_client()
wiql_query = f"""
SELECT [System.Id]
FROM WorkItems
WHERE [System.TeamProject] = '{project_name}'
AND [System.WorkItemType] = '{item_type}'
ORDER BY [System.Id]
"""
query_result = work_item_tracking_client.query_by_wiql(wiql=wiql_query)
work_item_ids = [item.id for item in query_result.work_items]
print(f"Retrieved {len(work_item_ids)} backlog item IDs from project '{project_name}'.")
return work_item_ids
except Exception as e:
print(f"Error retrieving backlog item IDs: {str(e)}")
return []


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant