microsoft / microsoft/azure-devops-python-api

query_by_wiql throws exception

Open
#510 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
684
Forks
218
Avg merge
8d 10h
Merged PRs (30d)
1

Description

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 []


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the work item tracking client's query_by_wiql entry point and reproduce the exception with the WIQL shown in the issue. Check the expected shape of the wiql argument and verify that the query returns work item IDs without a deserialization error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.