You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There was a change between 2.2.0.X and 2.4.X where the querying behavior no longer works if the initial query to get features returns a 500 error. There used to be logic which would set a the returnRecordCount and do pagination. This logic is broken in version 2.4.X.
To Reproduce
Steps to reproduce the behavior:
importarcgis# This service must have a very high Max Record Count (e.g. 1 million)# We have a valid use case for this super high Max Record count because some other applications do not paginate.# This is just one way to trigger this issuelayer="https://<some-layer-with-400k-features>/FeatureServer/0"feature_layer=arcgis.features.FeatureLayer(url=layer)
count=feature_layer.query(return_count_only=True)
print(f"Expected Count: {count}")
results=feature_layer.query(out_sr=4326, as_df=True)
print(len(results['features']))
output:
Expected Count: 336731
1000
Only the first 1000 records are returned from the layer. It should be comparing the max_rec with the total count of the features not with the max_records which is 1000 by default.
The bug is in: arcgis\features\layer.py
def_retry_query_with_fewer_records(layer, url, params, raw):
"""Retries the query with a reduced result record count."""max_record=params.get("resultRecordCount", 1000)
offset=params.get("resultOffset", 0)
ifmax_record<250:
raiseException("Max record count too low; query still failing.")
result=Nonemax_rec= (max_record+1) //2# Halve the record counti=0whilemax_rec*i<max_record:
params["resultRecordCount"] =min(max_rec, max_record-max_rec*i)
params["resultOffset"] =offset+max_rec*itry:
records=_query(layer, url, params, raw=True)
ifresult:
result["features"].extend(records["features"])
else:
result=recordsi+=1exceptExceptionasretry_exception:
raiseretry_exception
Screenshots
If applicable, add screenshots to help explain your problem.
Expected behavior
All features should be returned. This works in 2.2.0.4.
Platform (please complete the following information):
OS: Windows 11
Browser N/A
Python API Version 2.4.0
Additional context
Add any other context about the problem here, attachments etc.
The text was updated successfully, but these errors were encountered:
@apulverizer Thanks for catching that, I will make an update. In the meantime you could set the result record count equal to total number expected for it to not default to 1000
Describe the bug
There was a change between 2.2.0.X and 2.4.X where the querying behavior no longer works if the initial query to get features returns a 500 error. There used to be logic which would set a the returnRecordCount and do pagination. This logic is broken in version 2.4.X.
To Reproduce
Steps to reproduce the behavior:
output:
Only the first 1000 records are returned from the layer. It should be comparing the max_rec with the total count of the features not with the max_records which is 1000 by default.
The bug is in:
arcgis\features\layer.py
Screenshots
If applicable, add screenshots to help explain your problem.
Expected behavior
All features should be returned. This works in 2.2.0.4.
Platform (please complete the following information):
Additional context
Add any other context about the problem here, attachments etc.
The text was updated successfully, but these errors were encountered: