<?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: makeQueryTable fails to execute in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339833#M26672</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Might be your fieldList variable. Looking at the docs, I think that should be a list of lists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fieldList = [["sales.id",'id']]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:04:25 GMT</pubDate>
    <dc:creator>MattSayler</dc:creator>
    <dc:date>2021-12-11T16:04:25Z</dc:date>
    <item>
      <title>makeQueryTable fails to execute</title>
      <link>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339832#M26671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had this working on my local computer but when switching it over to the server it is failing with the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000793: Invalid data element type&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000840: The value is not a Raster Layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (MakeQueryTable).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think is has something to do with the OLE DB connection...when I open the connection in arcCatalog it takes a longgggg time to open. Maybe it is timing out in the script and thus that is why it is failing? I have included my code below too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableList = ["DATABASE CONNECTIONS/prod.odc/sales"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldList = ["sales.id",'id']&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = "sales.CREATED_DATE between to_date(sysdate, 'DD-MON-YYYY') AND SYSDATE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyField = "sales.id"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrName = "live_sales"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create the spatial reference for the output layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr = arcpy.SpatialReference("WGS 1984 UTM Zone 12N")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a query layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeQueryTable_management(tableList, lyrName,"USE_KEY_FIELDS", keyField, fieldList, whereClause)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save the created query layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SaveToLayerFile_management(lyrName,"I:/sales.lyr", "ABSOLUTE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; # Print the total rows&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(lyrName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Oct 2013 11:45:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339832#M26671</guid>
      <dc:creator>DaveTaylor</dc:creator>
      <dc:date>2013-10-31T11:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: makeQueryTable fails to execute</title>
      <link>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339833#M26672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Might be your fieldList variable. Looking at the docs, I think that should be a list of lists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fieldList = [["sales.id",'id']]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:04:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339833#M26672</guid>
      <dc:creator>MattSayler</dc:creator>
      <dc:date>2021-12-11T16:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: makeQueryTable fails to execute</title>
      <link>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339834#M26673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;sorry about the code...here it is...I tried changing fieldList too and that didnt work either:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;tableList = ["DATABASE CONNECTIONS/prod.odc/sales"]
fieldList = ["sales.id",'id']
whereClause = "sales.CREATED_DATE between to_date(sysdate, 'DD-MON-YYYY') AND SYSDATE"
keyField = "sales.id"
lyrName = "live_sales"

#Create the spatial reference for the output layer.
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 12N")
# Create a query layer
arcpy.MakeQueryTable_management(tableList, lyrName,"USE_KEY_FIELDS", keyField, fieldList, whereClause)
# save the created query layer
arcpy.SaveToLayerFile_management(lyrName,"I:/sales.lyr", "ABSOLUTE")
# Print the total rows
print arcpy.GetCount_management(lyrName)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:04:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makequerytable-fails-to-execute/m-p/339834#M26673</guid>
      <dc:creator>DaveTaylor</dc:creator>
      <dc:date>2021-12-11T16:04:28Z</dc:date>
    </item>
  </channel>
</rss>

