<?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: How to get attachments size with Python script in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1299978#M52867</link>
    <description>&lt;P&gt;Found this post and am wondering if there are any ideas on the disparity I see when querying the size of the attachments through the Python API versus what is shown on the item page...?&lt;/P&gt;&lt;P&gt;If I query the attachments through the Python API for a feature layer of interest, I get 1.35GB.&amp;nbsp; However, if I look at the item page, it shows 3.3GB.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Python API query --- bytes converted to GB&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_0-1686860233067.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73418i6F7CED180CE1865A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_0-1686860233067.png" alt="mpboyle_0-1686860233067.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item page&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_1-1686860413149.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73419iCB5C4FD2F585A5F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_1-1686860413149.png" alt="mpboyle_1-1686860413149.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 20:23:04 GMT</pubDate>
    <dc:creator>mpboyle</dc:creator>
    <dc:date>2023-06-15T20:23:04Z</dc:date>
    <item>
      <title>How to get attachments size with Python script</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1215431#M48034</link>
      <description>&lt;P&gt;Hello, we work in a big organization where we have many users and projects in ArcGIS Online. For us, it is very important to keep track of credit usage to assign its cost to the appropriate project. Also, we must recommend good practices to reduce and optimize credit usage. We have noticed that the main cost of credits come from storage.&lt;/P&gt;&lt;P&gt;Even though ArcGIS Online provides specific reports that offer information about the size of different items, detailing the size of feature storage and file storage, we need to exploit this information in an external database to obtain dashboards personalized for our purposes.&lt;/P&gt;&lt;P&gt;We have developed a Python script that gets all information that we need from our AGOL, and download it in our database weekly. But we cannot get some data as total attachments size unless it gets through each feature in every layer, which can take hours or days.&lt;/P&gt;&lt;P&gt;This information is clearly somewhere in ArcGIS on line, linked to each item. It is provided in the reports and in the details shown in the item page, so it seem easy to get. But we have not found the property to query this information easily with our script (something as featureLayer.properties.AttachmentsSize).&lt;/P&gt;&lt;P&gt;Has anybody found the way to query attachments size with a unique command instead of querying each individual item of a layer?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 10:20:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1215431#M48034</guid>
      <dc:creator>C-Alonso</dc:creator>
      <dc:date>2022-09-23T10:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get attachments size with Python script</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1215494#M48037</link>
      <description>&lt;P&gt;Take a look at &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#attachmentmanager" target="_blank"&gt;&lt;STRONG&gt;arcgis.features.managers.AttachmentManager&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;There is a method &lt;STRONG&gt;search&lt;/STRONG&gt;, which, according to the docs:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;allows querying the layer for its attachments and returns the results as a Pandas DataFrame or dict&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It is possible to use this on a per-layer basis to return the details of &lt;EM&gt;all &lt;/EM&gt;attachments. On of the included fields in the output dataframe (assuming you include the parameter&amp;nbsp;&lt;STRONG&gt;as_df=True&lt;/STRONG&gt;) is &lt;STRONG&gt;SIZE&lt;/STRONG&gt;, which you can use to calculate the total size of all attachments on the layer using &lt;STRONG&gt;DataFrame['SIZE'].sum()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1663940270390.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52021i435F113F40740CCA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1663940270390.png" alt="jcarlson_0-1663940270390.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So you'll still need to iterate over every layer in your org, but you could easily get an org-wide overview of how much storage each layer's attachments are taking up.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 13:42:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1215494#M48037</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-09-23T13:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get attachments size with Python script</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1215957#M48049</link>
      <description>&lt;P&gt;Great!, it worked. Thank you very much.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 07:37:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1215957#M48049</guid>
      <dc:creator>C-Alonso</dc:creator>
      <dc:date>2022-09-26T07:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get attachments size with Python script</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1216922#M48098</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 13:56:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1216922#M48098</guid>
      <dc:creator>MMeer</dc:creator>
      <dc:date>2022-09-28T13:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get attachments size with Python script</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1299978#M52867</link>
      <description>&lt;P&gt;Found this post and am wondering if there are any ideas on the disparity I see when querying the size of the attachments through the Python API versus what is shown on the item page...?&lt;/P&gt;&lt;P&gt;If I query the attachments through the Python API for a feature layer of interest, I get 1.35GB.&amp;nbsp; However, if I look at the item page, it shows 3.3GB.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Python API query --- bytes converted to GB&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_0-1686860233067.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73418i6F7CED180CE1865A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_0-1686860233067.png" alt="mpboyle_0-1686860233067.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item page&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_1-1686860413149.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73419iCB5C4FD2F585A5F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_1-1686860413149.png" alt="mpboyle_1-1686860413149.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 20:23:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1299978#M52867</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2023-06-15T20:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get attachments size with Python script</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1302230#M53029</link>
      <description>&lt;P&gt;I believe I have resolved my issue, which is the number of attachments is greater than the max record count of the service.&amp;nbsp; In order to retrieve all attachments, I needed to use the "max_records" and "offset" parameters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample code can be found &lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/query-feature-layer-feature-and-attachment-storage/m-p/1302105" target="_self"&gt;here&lt;/A&gt; if anyone needs it for future reference.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 20:37:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-get-attachments-size-with-python-script/m-p/1302230#M53029</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2023-06-22T20:37:38Z</dc:date>
    </item>
  </channel>
</rss>

