First off, let me just say that I am liking what I discovered, but I can't find docs to confirm if this is a bug or a feature.
I was setting up a .query() call in a loop to handle pagination of a layer and realized that when I set the following conditions specifically, .query() handles the looping on its own and gives me a complete dataframe with all the data from the feature service:
See application of .query() below.
sdf = layer.query(where="1=1", as_df=True, return_all_records=False, result_record_count=num_features_per_page)
sdf_rows = len(sdf)
print(f'sdf_rows = {sdf_rows}')
sdf
It seems contradictory that return_all_records=False is helping me to receive all records. If this is acting as expected, does anyone know of documentation that makes this clear?
I am about to put a solution into production, and I don't want to find out this was a bug that is going to be fixed in some upcoming patch.
return_all_records | Optional boolean. When True, the query operation will call the service until all records that satisfy the where_clause are returned. Note: result_offset and result_record_count will be ignored if return_all_records is True. Also, if return_count_only, return_ids_only, or return_extent_only are True, this parameter will be ignored. If this parameter is set to False but no other limit is specified, the default is True. |
sounds like a hierarchy of booleans, but the last line is confusing too,... so if no other limits are set it sets it back to True?.....
I've used the .query and not set any of these and it return all records, even past the REST's MaxRecordCount
another great advantage is the .save on the returned Feature Set to go right to Shapefile (not using the 'as_df=True')