<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: .query() as_df=True pagination functionality - Bug or Feature? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/query-as-df-true-pagination-functionality-bug-or/m-p/1620879#M11431</link>
    <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.features.toc.html#arcgis.features.FeatureLayer.query" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/latest/api-reference/arcgis.features.toc.html#arcgis.features.FeatureLayer.query&lt;/A&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;return_all_records&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;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.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?.....&lt;/P&gt;&lt;P&gt;I've used the .query and not set any of these and it return all records, even past the REST's MaxRecordCount&lt;/P&gt;&lt;P&gt;another great advantage is the .save on the returned Feature Set to go right to Shapefile (not using the 'as_df=True')&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;fl&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;S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N&gt;&lt;SPAN&gt;'.shp'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 04 Jun 2025 16:59:36 GMT</pubDate>
    <dc:creator>RDCOGIS</dc:creator>
    <dc:date>2025-06-04T16:59:36Z</dc:date>
    <item>
      <title>.query() as_df=True pagination functionality - Bug or Feature?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/query-as-df-true-pagination-functionality-bug-or/m-p/1616571#M11406</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;as_df=True&lt;/LI&gt;&lt;LI&gt;return_all_records=False&lt;/LI&gt;&lt;LI&gt;result_record_count=[any int above 0]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;See application of .query() below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:39:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/query-as-df-true-pagination-functionality-bug-or/m-p/1616571#M11406</guid>
      <dc:creator>BrandoCrozier</dc:creator>
      <dc:date>2025-05-20T17:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: .query() as_df=True pagination functionality - Bug or Feature?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/query-as-df-true-pagination-functionality-bug-or/m-p/1620879#M11431</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.features.toc.html#arcgis.features.FeatureLayer.query" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/latest/api-reference/arcgis.features.toc.html#arcgis.features.FeatureLayer.query&lt;/A&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;return_all_records&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;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.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?.....&lt;/P&gt;&lt;P&gt;I've used the .query and not set any of these and it return all records, even past the REST's MaxRecordCount&lt;/P&gt;&lt;P&gt;another great advantage is the .save on the returned Feature Set to go right to Shapefile (not using the 'as_df=True')&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;fl&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;_itemUrl&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;features&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;fl&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;query&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;'Shape&amp;nbsp;is&amp;nbsp;not&amp;nbsp;NULL')&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;features&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;save&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;save_location&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;_pathShps&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;out_name&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;_friendlyName&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'.shp'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Jun 2025 16:59:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/query-as-df-true-pagination-functionality-bug-or/m-p/1620879#M11431</guid>
      <dc:creator>RDCOGIS</dc:creator>
      <dc:date>2025-06-04T16:59:36Z</dc:date>
    </item>
  </channel>
</rss>

