<?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: Updating enterprise feature class using ArcGIS API for Python in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331127#M12693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the rest of my code is not related to this. The only thing that has happened is I have declared some variables associated with the portal. I updated the request with the full error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Oct 2019 19:42:01 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2019-10-22T19:42:01Z</dc:date>
    <item>
      <title>Updating enterprise feature class using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331125#M12691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class=""&gt;&lt;P&gt;I have created a Python script that will turn some CSVs to features in a GDB and I am trying to get the feature class on my local machine to overwrite the feature on our enterprise portal. I have imported the arcgis.gis library and I think that I need to be using the &lt;CODE&gt;arcgis.gis.Datastore().update&lt;/CODE&gt;.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;gis = ag.GIS(portal, user, password)
&amp;nbsp;&amp;nbsp;&amp;nbsp;print(f'Connected to {portal}')
&amp;nbsp;&amp;nbsp;&amp;nbsp;print(ag.Datastore('ArcGIS_Data_Store', '\\portal-url\arcgisdatastore)').datasets)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It seems like I am getting logged in alright, but when I run this script I get the following error. I am unable to find any examples for this. How do others update their files in the datastore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;Connected to &lt;A href="https://portal-url/arcgis/" target="_blank"&gt;https://portal-url/arcgis/&lt;/A&gt;&lt;BR /&gt; File "W:/Research&amp;amp;Development/Data-Share/layers/trapeze/MetroBusStops/AutomationExports/py/CSV_2_FeatureClass_2_DataStore.py", line 65, in &amp;lt;module&amp;gt;&lt;BR /&gt; print(ag.Datastore(datastore='ArcGIS_Data_Store', path='&lt;A href="https://portal-url/arcgis/arcgisdatastore').datasets" target="_blank"&gt;https://portal-url/arcgis/arcgisdatastore').datasets&lt;/A&gt;)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 955, in __init__&lt;BR /&gt; self._portal = datastore._portal&lt;BR /&gt;AttributeError: 'str' object has no attribute '_portal'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.gis.toc.html#datastore" rel="nofollow noreferrer noopener" target="_blank"&gt;arcgis.gis.Datastore() Documentation&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE:&lt;/P&gt;&lt;P&gt;I have started using the FeatureLayerCollection module. I have imported at the top and have appended the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;BR /&gt;current_file = FeatureLayerCollection.fromitem.fromitem('&lt;A href="https://url/arcserver/rest/services/MetroBusStopsByLine_191021/MapServer/0" target="_blank"&gt;https://url/arcserver/rest/services/MetroBusStopsByLine_191021/MapServer/0&lt;/A&gt;')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;current_file.manager.overwrite(current_file.manager.overwrite('AutomationExports.gdb/MetroBusStopsByLine_191021'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;and I am getting the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "W:/Research&amp;amp;Development/Data-Share/layers/trapeze/MetroBusStops/AutomationExports/py/CSV_2_FeatureClass_2_DataStore.py", line 69, in &amp;lt;module&amp;gt;&lt;BR /&gt; current_file = FeatureLayerCollection.fromitem('&lt;A href="https://url/arcserver/rest/services/MetroBusStopsByLine_191021/MapServer/0" target="_blank"&gt;https://url/arcserver/rest/services/MetroBusStopsByLine_191021/MapServer/0&lt;/A&gt;')&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 9509, in fromitem&lt;BR /&gt; if not item.type.lower().endswith('service'):&lt;BR /&gt;AttributeError: 'str' object has no attribute 'type'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:21:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331125#M12691</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T16:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Updating enterprise feature class using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331126#M12692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is that your entire code? Based on the AttributeError I think something might have gone awry earlier in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2019 14:17:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331126#M12692</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2019-10-22T14:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Updating enterprise feature class using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331127#M12693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the rest of my code is not related to this. The only thing that has happened is I have declared some variables associated with the portal. I updated the request with the full error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2019 19:42:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331127#M12693</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-10-22T19:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Updating enterprise feature class using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331128#M12694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah ok, I see what you're saying. Are you sure you need to interact with the DataStore class?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may be misunderstanding your intent, but it sounds like what you want to do is update or overwrite a feature layer that's already hosted or registered with your portal. If so, there's a sample notebook that talks about taking CSV files, reading them using the pandas library, publishing the CSV as a feature layer, and then overwriting an existing feature layer. Hope this helps and I'm not way off base with what you're trying to do!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/" title="https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/"&gt;Overwriting feature layers | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2019 21:55:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331128#M12694</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2019-10-22T21:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Updating enterprise feature class using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331129#M12695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for following up on my reply. I have a little better handle on this now, but I am still unsure how to connect to an existing feature. I would assume that I would use the url on the feature layer page, but I am not able to find the function that would connect something like that. as far as the rest of the script that I have put together. I am using the overwrite() function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;current_file = FeatureLayerCollection.fromitem.fromitem('https://metroas08.metrostlouis.org/arcserver/rest/services/MetroBusStopsByLine_191021/MapServer/0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;current_file.manager.overwrite(current_file.manager.overwrite('AutomationExports.gdb/MetroBusStopsByLine_191021'))&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;and I am getting the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="background: none #f6f6f6; border-left: 2px solid #cccccc; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "W:/Research&amp;amp;Development/Data-Share/layers/trapeze/MetroBusStops/AutomationExports/py/CSV_2_FeatureClass_2_DataStore.py", line 69, in &amp;lt;module&amp;gt;&lt;BR /&gt;current_file = FeatureLayerCollection.fromitem('https://url/arcserver/rest/services/MetroBusStopsByLine_191021/MapServer/0')&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 9509, in fromitem&lt;BR /&gt;if not item.type.lower().endswith('service'):&lt;BR /&gt;AttributeError: 'str' object has no attribute 'type'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2019 21:00:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/updating-enterprise-feature-class-using-arcgis-api/m-p/331129#M12695</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-10-24T21:00:58Z</dc:date>
    </item>
  </channel>
</rss>

