<?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>idea add aggregate function support to arcpy.da.searchcursor in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idi-p/1195709</link>
    <description>&lt;P&gt;The python search cursor allows for using a postfix clause (i.e. group by), but it doesn't allow for using aggregate functions within the select clause.&amp;nbsp; For example, there isn't any way to produce a result set that's equivalent to the following sql using an arcpy searchcursor&lt;/P&gt;&lt;P&gt;select some_type_field, sum(some_numeric_field) as my_sum&lt;/P&gt;&lt;P&gt;from xyz_table&lt;/P&gt;&lt;P&gt;group by some_type_field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You CAN use the group by functionality if you don't include the aggregate function in the select clause, but half the reason for grouping data is often to perform aggregation on the results, without that grouping isn't very useful.&amp;nbsp; This can be worked around in very custom code situations (i.e. iterating over the result set and performing the aggregation manually), but that is super messy and not very reusable.&amp;nbsp; This functionality is especially needed for accessing a file geodatabase as the alternative workaround of using a query layer (which works fine against an enterprise geodatabase) isn't an option for use against a file geodatabase.&amp;nbsp; I suppose an alternative to adding the aggregation functionality to the search cursor would be to allow for query layer functionality against a file geodatabase, but I suspect that may be a bigger request to tackle &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2024 19:56:40 GMT</pubDate>
    <dc:creator>AJR</dc:creator>
    <dc:date>2024-04-05T19:56:40Z</dc:date>
    <item>
      <title>add aggregate function support to arcpy.da.searchcursor</title>
      <link>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idi-p/1195709</link>
      <description>&lt;P&gt;The python search cursor allows for using a postfix clause (i.e. group by), but it doesn't allow for using aggregate functions within the select clause.&amp;nbsp; For example, there isn't any way to produce a result set that's equivalent to the following sql using an arcpy searchcursor&lt;/P&gt;&lt;P&gt;select some_type_field, sum(some_numeric_field) as my_sum&lt;/P&gt;&lt;P&gt;from xyz_table&lt;/P&gt;&lt;P&gt;group by some_type_field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You CAN use the group by functionality if you don't include the aggregate function in the select clause, but half the reason for grouping data is often to perform aggregation on the results, without that grouping isn't very useful.&amp;nbsp; This can be worked around in very custom code situations (i.e. iterating over the result set and performing the aggregation manually), but that is super messy and not very reusable.&amp;nbsp; This functionality is especially needed for accessing a file geodatabase as the alternative workaround of using a query layer (which works fine against an enterprise geodatabase) isn't an option for use against a file geodatabase.&amp;nbsp; I suppose an alternative to adding the aggregation functionality to the search cursor would be to allow for query layer functionality against a file geodatabase, but I suspect that may be a bigger request to tackle &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 19:56:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idi-p/1195709</guid>
      <dc:creator>AJR</dc:creator>
      <dc:date>2024-04-05T19:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: add aggregate function support to arcpy.da.searchcursor</title>
      <link>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idc-p/1514689#M348</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/manage-file-gdb/sql-reporting-and-anlysis-file-geodatabases.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/manage-file-gdb/sql-reporting-and-anlysis-file-geodatabases.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;lists all the supported functions, but they are only available via. ArcObjects, not exposed via. an arcpy.da.SearchCursor.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2024 10:30:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idc-p/1514689#M348</guid>
      <dc:creator>AJR</dc:creator>
      <dc:date>2024-08-04T10:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: add aggregate function support to arcpy.da.searchcursor</title>
      <link>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idc-p/1514693#M349</link>
      <description>&lt;P&gt;This would be useful and is very much needed.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2024 12:06:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/add-aggregate-function-support-to-arcpy-da/idc-p/1514693#M349</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-08-04T12:06:38Z</dc:date>
    </item>
  </channel>
</rss>

