<?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: Reference non-SDE sql table in python script - arcpy.Append_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750884#M57995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can run the Append tool in the GUI without any issue; then go to the Results window, find the successful run, and then use the "Copy As Python Snippet" to see how the tool is setting up the arguments.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/executing-tools/using-the-results-window.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/executing-tools/using-the-results-window.htm"&gt;Using the Results window—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Feb 2018 13:56:30 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2018-02-22T13:56:30Z</dc:date>
    <item>
      <title>Reference non-SDE sql table in python script - arcpy.Append_management</title>
      <link>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750883#M57994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wondering if anyone can help with the syntax (or confirm that it can be done) to reference an SQL table that's in a non-spatial database in a python script&lt;/P&gt;&lt;P&gt;In my case I'm trying to append from this table into an SDE table.&amp;nbsp; I need the field mapping, because there is an ID field in the source table (non-spatial) that needs to be preserved and by default it treats it as an object id field, so it changes every time the job is run, which is a problem.&amp;nbsp; So it is mapped to the correct column in the target (SDE) table.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The connection to the SQL non-spatial database is fine in ArcMap, and I can run the append tool without issue.&amp;nbsp; Whne I grab the python snippet, no matter how I modify the table name/path, the Append_management section fails, saying 'Cannot open table...' (the input table).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what I have:&amp;nbsp; (only import currently is arcpy)&lt;/P&gt;&lt;P&gt;arcpy.Append_management&lt;/P&gt;&lt;P&gt;(inputs="SQLDB.TABLENAME.dbo.users",&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;*this is what the table is listed as under 'properties' in the catalog window in ArcMap&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;target=&amp;nbsp;SDE_DEV&amp;nbsp;+ "\TABLENAME_DEV",&lt;/P&gt;&lt;P&gt;schema_type="NO_TEST",&lt;/P&gt;&lt;P&gt;field_mapping=....)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SDE_DEV is a variable that is the path to the SDE connection file + sde file name to our dev sde database.&amp;nbsp; I've tried the same methodology for the input dataset, with no luck so far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gracias -&amp;nbsp;&lt;/P&gt;&lt;P&gt;Allen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Feb 2018 20:52:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750883#M57994</guid>
      <dc:creator>AllenScully</dc:creator>
      <dc:date>2018-02-21T20:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reference non-SDE sql table in python script - arcpy.Append_management</title>
      <link>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750884#M57995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can run the Append tool in the GUI without any issue; then go to the Results window, find the successful run, and then use the "Copy As Python Snippet" to see how the tool is setting up the arguments.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/executing-tools/using-the-results-window.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/executing-tools/using-the-results-window.htm"&gt;Using the Results window—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 13:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750884#M57995</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-02-22T13:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reference non-SDE sql table in python script - arcpy.Append_management</title>
      <link>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750885#M57996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Josh -&amp;nbsp;&lt;/P&gt;&lt;P&gt;The snippet from the tool result is in fact the original source for my code here.&amp;nbsp; It's been my experience that the snippet rarely works as-is with no modifications in an IDE (especially relating to datasources), and that was the case here, so I've tried many permutations of the paths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently have it so that the Append_management does read the input data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff;"&gt;(inputs=r"\\ServerName\DATABASECONNECTIONS\SQLCONNECTION.sde\UserName.dbo.tablename", target=...)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;where the DATABASECONNECTIONS folder contains the appropriate .sde connection file for the database in question.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it&amp;nbsp;actually adds the correct # of records to the target.&amp;nbsp; however every attribute minus objectid is null, which is fun.&amp;nbsp; I can figure that out - was mainly trying to see how to reference a non-spatial SQL table within this tool, and confirm that it's possible in an arcpy tool within a python script.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:38:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reference-non-sde-sql-table-in-python-script-arcpy/m-p/750885#M57996</guid>
      <dc:creator>AllenScully</dc:creator>
      <dc:date>2018-02-22T16:38:53Z</dc:date>
    </item>
  </channel>
</rss>

