我正在尝试使用 pyral 模块读取 Rally 中项目的所有特征数据。结果集总数为 1358,脚本在读取约 700 条记录后抛出如下所述的错误。
rally1 = Rally(entity='PortfolioItem_Feature',server='rally1.rallydev.com',fetch=True, user='xxx', password='', workspace='xxx/yyy', project='ABC')
features = rally1.get('Feature',fetch="True",pagesize=2000,start=0,limit=5000)
for feature in features:
#a=pd.DataFrame(feature)
print(feature.details())
输出:
PortfolioItem/Feature result set, totalResultSetSize: 1358, startIndex: 1 pageSize: 2000 current Index: 0
I'm getting the following errors:
File "C:\Users\nis\AppData\Roaming\Python\Python38\site-packages\pyral\entity.py", line 397, in details
(attr_name, cln, value.oid, value.UserName, value.DisplayName)
File "C:\Users\nis\AppData\Roaming\Python\Python38\site-packages\pyral\entity.py", line 139, in __getattr__
raise UnreferenceableOIDError("%s OID %s" % (rallyEntityTypeName, self.oid))
pyral.entity.UnreferenceableOIDError: User OID 44012386960
所以,我有以下问题:
- 如何修复此错误,这意味着跳过读取特征属性的特定字段或将其替换为空结果集。
- 如何将 (a) <class 'pyral.rallyresp.RallyRESTResponse'> (b) PortfolioItem/Feature 结果集转换为数据框而不会出现上述错误。
我正在使用下面的代码,这个脚本也读了大约。700 条记录并引发与上述相同的错误。我尝试使用错误处理,但它在遇到错误时停止读取。任何帮助将不胜感激。
r=pd.DataFrame()
for feature in features:
a= {
'OID': feature.oid,
'FeatureID':feature.FormattedID,
'Creation_Date': feature.CreationDate,
'Project_Name': feature.Project.Name,
'AcceptedLeafStoryPlanEstimateTotal':feature.AcceptedLeafStoryPlanEstimateTotal,
'AcceptedLeafStoryPlanEstimateTotal':feature.AcceptedLeafStoryPlanEstimateTotal,
'Feature_payload':feature._ref,
'Created by':feature.CreatedBy.DisplayName
}
#print(a.keys())
#print(a.values())
r=r.append(a,ignore_index=True,sort=False)
print(r)