<?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: Enable edit session for particular layer in a versioned geodatabase in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417265#M70497</link>
    <description>&lt;P&gt;There is currently only the default version of the database so the sde version should suffice. Is there a method to take the layer name from the input parameter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies i am new to Python. I can see there is the arcpy.GetParameter() method, is there a way in ArcGIS Pro I could play around the GetParameter or GetParameterAsStrings methods interactively to see what is returned from my chosen inputs?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Apr 2024 21:23:42 GMT</pubDate>
    <dc:creator>SouthCoastGIS</dc:creator>
    <dc:date>2024-04-30T21:23:42Z</dc:date>
    <item>
      <title>Enable edit session for particular layer in a versioned geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1416943#M70491</link>
      <description>&lt;P&gt;Hello, I am looking to enable an edit session for a particular versioned layer in an ESRI geodatabase. I have a script tool where you select a layer as a parameter, but I get the following error:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;RuntimeError: Objects in this class cannot be updated outside an edit session &lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;So my question is this. Am i able to enable an edit session for a given versioned geodatabase layer through Python scripting, or is there a way to enable an editing session for a layer through model builder before running the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script I am attempting to run has this information listed at the beginning.&lt;/P&gt;&lt;PRE&gt;"""
Assetic.CreateAssetsTbxScript.py
Script to setup as a toolbox script for use in Model Builder
create assets in Assetic from the selected features in ArcGIS layer
Assume Model Builder model has applied a feature selection
This example assumes script is run in an edit session
Requires assetic_esri v1.0.1.4 or later
"""&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 02:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1416943#M70491</guid>
      <dc:creator>SouthCoastGIS</dc:creator>
      <dc:date>2024-05-28T02:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Enable edit session for particular layer in a versioned geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1416949#M70492</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/758509"&gt;@SouthCoastGIS&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can use:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcpy.da import Editor as Editing, UpdateCursor as Updating, InsertCursor as Inserting, SearchCursor as Searching
##with arcpy.da.Editor( Workspace/database ) as edit:
##    with ( Searching( ), Inserting( ) , Updating( ) ) as cursor:
##         for row in cursor:
##             logic handeling
##             cursor.updateRow/cursor.insertRow( row )
          &lt;/LI-CODE&gt;&lt;P&gt;There is plenty of documentation on editor if you research into it.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 11:09:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1416949#M70492</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2024-04-30T11:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Enable edit session for particular layer in a versioned geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417020#M70493</link>
      <description>&lt;P&gt;In this case, since you are pointing at a layer input by the user, I would suggest that the user have the database connection pointed to the correct version when it's input. If not, you could either create a new &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-database-connection.htm" target="_self"&gt;database connection&lt;/A&gt;&amp;nbsp;(or &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-database-connection-string.htm" target="_self"&gt;connection string&lt;/A&gt;) pointed to the version you want.&lt;/P&gt;&lt;P&gt;Or you can try useing&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/changeversion.htm" target="_self"&gt;Change Version&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 14:09:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417020#M70493</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-04-30T14:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Enable edit session for particular layer in a versioned geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417265#M70497</link>
      <description>&lt;P&gt;There is currently only the default version of the database so the sde version should suffice. Is there a method to take the layer name from the input parameter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies i am new to Python. I can see there is the arcpy.GetParameter() method, is there a way in ArcGIS Pro I could play around the GetParameter or GetParameterAsStrings methods interactively to see what is returned from my chosen inputs?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 21:23:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417265#M70497</guid>
      <dc:creator>SouthCoastGIS</dc:creator>
      <dc:date>2024-04-30T21:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Enable edit session for particular layer in a versioned geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417278#M70498</link>
      <description>&lt;P&gt;Using&amp;nbsp;&lt;SPAN&gt;arcpy.GetParameter() returns the object that was input for that parameter when running the tool; whatever you have set as the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/defining-parameter-data-types-in-a-python-toolbox.htm" target="_self"&gt;parameter datatype&lt;/A&gt;. In the case of your tool here, if it isGPFeatureLayer or GPLayer, the return value of GetParameter() will be a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layer-class.htm" target="_self"&gt;Layer&lt;/A&gt; object so you'll have access to all that object's properties and methods. connectionProperties,&amp;nbsp;dataSource,&amp;nbsp;longName, or&amp;nbsp;name might be the property you're looking for.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layer = arcpy.GetParameter(0)


def main(layer):
    arcpy.AddMessage(f"connectionProperties: {layer.connectionProperties}")
    arcpy.AddMessage(f"dataSource: {layer.dataSource}")
    arcpy.AddMessage(f"longName: {layer.longName}")
    arcpy.AddMessage(f"name: {layer.name}")


if __name__ == "__main__":
    main(layer)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 21:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/enable-edit-session-for-particular-layer-in-a/m-p/1417278#M70498</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-04-30T21:45:21Z</dc:date>
    </item>
  </channel>
</rss>

