<?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 SQL Server - changing version within arcpy.ArcSDESQLExecute in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251668#M8202</link>
    <description>&lt;P&gt;I am testing some methods for quality control of data edited within a version (traditional, not branch) that is not the Default version.&amp;nbsp; I am exploring using the versioned views through arcpy.ArcSDESQLExecute (currently via ArcGIS Pro 2.9.5).&amp;nbsp; To change the version, I am calling an "execute" on the object created with ArcSDESQLExecute&lt;/P&gt;&lt;P&gt;EXEC dbo.set_current_version "&lt;EM&gt;versionname&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;That seems to work fine if I am the owner of the version and can just supply the version name.&amp;nbsp; However if I need to switch to a version owned by someone else and the owner format is&amp;nbsp;&lt;EM&gt;domain\username&lt;/EM&gt;&amp;nbsp; (SQL Server Active Directory authentication), then I am trying to pass&amp;nbsp;&lt;EM&gt;domain\username.versionname&lt;/EM&gt;&amp;nbsp;of some sort, usually returning "version not found".&amp;nbsp; If the owner of the version is not of the&amp;nbsp;&lt;EM&gt;domain\username&lt;/EM&gt; format, I seem to be able to make this work.&lt;/P&gt;&lt;P&gt;I am quite new to SQL Server so I might be failing to understand something there, or I'm not handling the backslash well for Python, or this might just be a really bad idea!&amp;nbsp; Thank you if anyone has a hint, otherwise I'll keep plugging away at this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jan 2023 22:49:36 GMT</pubDate>
    <dc:creator>Steve_Salas</dc:creator>
    <dc:date>2023-01-25T22:49:36Z</dc:date>
    <item>
      <title>SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251668#M8202</link>
      <description>&lt;P&gt;I am testing some methods for quality control of data edited within a version (traditional, not branch) that is not the Default version.&amp;nbsp; I am exploring using the versioned views through arcpy.ArcSDESQLExecute (currently via ArcGIS Pro 2.9.5).&amp;nbsp; To change the version, I am calling an "execute" on the object created with ArcSDESQLExecute&lt;/P&gt;&lt;P&gt;EXEC dbo.set_current_version "&lt;EM&gt;versionname&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;That seems to work fine if I am the owner of the version and can just supply the version name.&amp;nbsp; However if I need to switch to a version owned by someone else and the owner format is&amp;nbsp;&lt;EM&gt;domain\username&lt;/EM&gt;&amp;nbsp; (SQL Server Active Directory authentication), then I am trying to pass&amp;nbsp;&lt;EM&gt;domain\username.versionname&lt;/EM&gt;&amp;nbsp;of some sort, usually returning "version not found".&amp;nbsp; If the owner of the version is not of the&amp;nbsp;&lt;EM&gt;domain\username&lt;/EM&gt; format, I seem to be able to make this work.&lt;/P&gt;&lt;P&gt;I am quite new to SQL Server so I might be failing to understand something there, or I'm not handling the backslash well for Python, or this might just be a really bad idea!&amp;nbsp; Thank you if anyone has a hint, otherwise I'll keep plugging away at this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 22:49:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251668#M8202</guid>
      <dc:creator>Steve_Salas</dc:creator>
      <dc:date>2023-01-25T22:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251727#M8203</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/265526"&gt;@Steve_Salas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Are the versions owned by the domain accounts set to public?&lt;/P&gt;&lt;P&gt;Versions owned by AD user's is not a problem.&lt;/P&gt;&lt;P&gt;To see if we can even change to a AD version using your account, you can also try using the arcpy change version in python. This will let us know what the correct syntax would be.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/changeversion.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/changeversion.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marlon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 01:30:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251727#M8203</guid>
      <dc:creator>MarlonAmaya</dc:creator>
      <dc:date>2023-01-26T01:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251898#M8204</link>
      <description>&lt;P&gt;Hi Marlon, the versions are actually Protected, so visible and I can Change Version:&lt;/P&gt;&lt;PRE&gt;arcpy.management.ChangeVersion("CS Pasture Polygons", "TRANSACTIONAL", r'"domain\username".EDITS-20230123-105229', None, "INCLUDE")&lt;BR /&gt;&amp;lt;Result 'CS Pasture Polygons'&amp;gt;&lt;/PRE&gt;&lt;P&gt;If I try to transfer that same format to ArcSDESQLExecute:&lt;/P&gt;&lt;PRE&gt;ASEObj.execute(r'EXEC dbo.set_current_version "domain\username".EDITS-20230123-105229')&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\arcobjects.py", line 44, in execute&lt;BR /&gt;return convertArcObjectToPythonObject(self._arc_object.Execute(*gp_fixargs(args)))&lt;BR /&gt;AttributeError: ArcSDESQLExecute: StreamPrepareSQL ArcSDE Extended error 102 [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near '.'.&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Jan 2023 15:47:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251898#M8204</guid>
      <dc:creator>Steve_Salas</dc:creator>
      <dc:date>2023-01-26T15:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251924#M8205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/265526"&gt;@Steve_Salas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please try&lt;/P&gt;&lt;PRE&gt;ASEObj.execute(r'EXEC dbo.set_current_version '"domain\username".EDITS-20230123-105229'')&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Jan 2023 16:36:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1251924#M8205</guid>
      <dc:creator>MarlonAmaya</dc:creator>
      <dc:date>2023-01-26T16:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1252144#M8206</link>
      <description>&lt;P&gt;Definitely flagged the unbalanced quotes in the Python window in ArcGIS Pro, but I hit&amp;nbsp;&lt;EM&gt;return&lt;/EM&gt; anyway...&lt;/P&gt;&lt;PRE&gt;ASEObj.execute(r'EXEC dbo.set_current_version '"domain\username".EDITS-20230123-105229'')&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 1&lt;BR /&gt;ASEObj.execute(r'EXEC dbo.set_current_version '"domain\username".EDITS-20230123-105229'')&lt;BR /&gt;^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 22:11:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1252144#M8206</guid>
      <dc:creator>Steve_Salas</dc:creator>
      <dc:date>2023-01-26T22:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1252575#M8212</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/265526"&gt;@Steve_Salas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may want to submit a support ticket.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marlon&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 22:58:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1252575#M8212</guid>
      <dc:creator>MarlonAmaya</dc:creator>
      <dc:date>2023-01-27T22:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server - changing version within arcpy.ArcSDESQLExecute</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1258892#M8270</link>
      <description>&lt;P&gt;Worked with&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/30653"&gt;@MarlonAmaya&lt;/a&gt; via an ESRI support ticket and he arrived at this:&lt;/P&gt;&lt;PRE&gt;ret = ASEObj.execute( '''exec dbo.set_current_version '"DOM\USERNAME".EDITS-20230210-084247' ''')&lt;/PRE&gt;&lt;P&gt;And for scripting purposes with version name as a variable I ended up with:&lt;/P&gt;&lt;PRE&gt;qcVers = '"DOM\USERNAME".EDITS-20230210-084247'&lt;BR /&gt;ret = ASEObj.execute( '''exec dbo.set_current_version '%s' ''' % qcVers)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 15:16:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-server-changing-version-within-arcpy/m-p/1258892#M8270</guid>
      <dc:creator>Steve_Salas</dc:creator>
      <dc:date>2023-02-16T15:16:53Z</dc:date>
    </item>
  </channel>
</rss>

