<?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: ValueError: Row: Invalid input value for setting - when inserting rows in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177711#M13661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;James,&lt;BR /&gt;&lt;BR /&gt;That did it!&lt;BR /&gt;&lt;BR /&gt;Thank you so much!&lt;BR /&gt;&lt;BR /&gt;Darina&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Excellent!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Nov 2012 14:54:16 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2012-11-02T14:54:16Z</dc:date>
    <item>
      <title>ValueError: Row: Invalid input value for setting - when inserting rows</title>
      <link>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177708#M13658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Here is what I want to do: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; - select data from a SQL Server database, which is not SDE using pyodbc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; - insert the records returned by the select into a table in a geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; I am getting the following error: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;***********************************************&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "E:\Workspace\Warehouse\PythonScripts\PerformSpatialJoins.py", line 80, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyRow.YCoord = row.YCoord&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\_base.py", line 35, in __setattr__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return setattr(self._arc_object, attr, ao)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ValueError: Row: Invalid input value for setting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;***********************************************&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand that it doesn't like the value of the XCoord, but I don't understand why it doesn't like it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The data type of the XCoord in the SQL Server table is "numeric", and the data type of the XCoord in the geodatabase table is "double". I also tried float and long integer (the coordinates are integer values even if they are in a numeric field). I always get this error. If I don't insert the XCoord and YCoord attributes, the script works as expected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea is greatly appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is the python script: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import arcpy module import arcpy import pyodbc import os&amp;nbsp; # Set Geoprocessing environments arcpy.env.overwriteOutput = True&amp;nbsp; DatabaseConnectionString = "Driver={SQL Server Native Client 10.0};SERVER=myserver;DATABASE=mydatabase;Trusted_Connection=yes" LocationsForGISProcessing = "dbo.vw_myview"&amp;nbsp; ScratchGeodatabasePath = "E:\\Workspace\\Warehouse\\ScratchWorkspace\\Scratch.gdb" TempLocationsForGISProcessing = "LocationsForGISProcessing"&amp;nbsp;&amp;nbsp; ##################################################################################### # Create ODBC connection &amp;nbsp;&amp;nbsp; conn = pyodbc.connect(DatabaseConnectionString) cursor = conn.cursor()&amp;nbsp; print "Connected to database"&amp;nbsp; ################################################################################## # Insert the data into the geodatabase&amp;nbsp; TempTable = ScratchGeodatabasePath + "\\" + TempLocationsForGISProcessing&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Delete Rows From Previous Load arcpy.DeleteRows_management(TempTable)&amp;nbsp; arcpyCursor = arcpy.InsertCursor(TempTable)&amp;nbsp; cursor.execute("SELECT * FROM " + LocationsForGISProcessing) rows = cursor.fetchall() for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyRow = arcpyCursor.newRow()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyRow.Location_Key = row.Location_Key&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyRow.From_Date = row.From_Date &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyRow.XCoord = row.XCoord &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyRow.YCoord = row.YCoord &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpyCursor.insertRow(arcpyRow)&amp;nbsp;&amp;nbsp;&amp;nbsp; # Delete the arcypy cursor del arcpyCursor&amp;nbsp;&amp;nbsp; # Close the connection if (cursor is not None): &amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.close() &amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (conn is not None):&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; conn.close() &amp;nbsp;&amp;nbsp;&amp;nbsp; del conn &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 20:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177708#M13658</guid>
      <dc:creator>DarinaTchountcheva</dc:creator>
      <dc:date>2012-11-01T20:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: ValueError: Row: Invalid input value for setting - when inserting rows</title>
      <link>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177709#M13659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried an explicit conversion from numeric type to float?&amp;nbsp; (I could be mistaken on this, but aren't Python "Double" types actually "Float"?).&amp;nbsp; Anyway, try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# convert the sqlserver type from numeric to float arcpyRow.XCoord = float(row.XCoord)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# or maybe attempt to use a variable if the above fails xval = float(row.XCoord) arcpyRow.XCoord = xval&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 11:15:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177709#M13659</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2012-11-02T11:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: ValueError: Row: Invalid input value for setting - when inserting rows</title>
      <link>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177710#M13660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;James,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That did it!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Darina&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 14:50:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177710#M13660</guid>
      <dc:creator>DarinaTchountcheva</dc:creator>
      <dc:date>2012-11-02T14:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: ValueError: Row: Invalid input value for setting - when inserting rows</title>
      <link>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177711#M13661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;James,&lt;BR /&gt;&lt;BR /&gt;That did it!&lt;BR /&gt;&lt;BR /&gt;Thank you so much!&lt;BR /&gt;&lt;BR /&gt;Darina&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Excellent!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 14:54:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/valueerror-row-invalid-input-value-for-setting/m-p/177711#M13661</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2012-11-02T14:54:16Z</dc:date>
    </item>
  </channel>
</rss>

