<?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: Cleaning Up Query Layers in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1053035#M60957</link>
    <description>&lt;P&gt;If the ORA error is returned, then most likely it is hung up somewhere in your SQL and should not have anything to do with the deletion event you are attempting.&lt;/P&gt;&lt;P&gt;Some questions to ask:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;are you passing the SQL as a string? If so, how are you using quotes on the string?&lt;/LI&gt;&lt;LI&gt;Are there special characters in your SQL that is causing the error?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;From Oracle Documentation: &lt;A href="https://docs.oracle.com/cd/B28359_01/server.111/b28278/e900.htm#ORA-00910" target="_blank"&gt;https://docs.oracle.com/cd/B28359_01/server.111/b28278/e900.htm#ORA-00910&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Other sources for troubleshooting: &lt;A href="https://www.techonthenet.com/oracle/errors/ora00911.php" target="_blank"&gt;https://www.techonthenet.com/oracle/errors/ora00911.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But, you should post your code so others can look and troubleshoot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Apr 2021 01:18:05 GMT</pubDate>
    <dc:creator>MikeMacRae</dc:creator>
    <dc:date>2021-04-30T01:18:05Z</dc:date>
    <item>
      <title>Cleaning Up Query Layers</title>
      <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1052969#M60955</link>
      <description>&lt;P&gt;I'm using arcpy.management.MakeQueryLayer to run a SQL statement in an Oracle database and return a table.&amp;nbsp; It works successfully and I am able to acces the data I need through a SearchCursor, but I feel like I should delete the query table when I am done.&amp;nbsp; If I were in ArcGIS Pro, it would create a table view, so I feel like I should clean up after myself.&amp;nbsp; I tried using arcpy.management.Delete on the name of the query table that I passed to MakeQueryLayer, but it gives me the following error:&lt;BR /&gt;&lt;BR /&gt;arcgisscripting.ExecuteError: Underlying DBMS error[ORA-00911: invalid character&lt;BR /&gt;ORA-00911: invalid character] Underlying DBMS error[ORA-00911: invalid character&lt;BR /&gt;ORA-00911: invalid character]&lt;/P&gt;&lt;P&gt;This seems kind of strange to me why Oracle would be involved.&amp;nbsp; I did try saving the result of MakeQueryLayer and then using del on the arcpy._mp.Table object.&amp;nbsp; It did delete the object and when I try to read the query layer again using its name, arcpy no longer recognizes it.&amp;nbsp; Still, I'm wondering if this is the correct approach.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 22:17:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1052969#M60955</guid>
      <dc:creator>NathanHeickLACSD</dc:creator>
      <dc:date>2021-04-29T22:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cleaning Up Query Layers</title>
      <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1053035#M60957</link>
      <description>&lt;P&gt;If the ORA error is returned, then most likely it is hung up somewhere in your SQL and should not have anything to do with the deletion event you are attempting.&lt;/P&gt;&lt;P&gt;Some questions to ask:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;are you passing the SQL as a string? If so, how are you using quotes on the string?&lt;/LI&gt;&lt;LI&gt;Are there special characters in your SQL that is causing the error?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;From Oracle Documentation: &lt;A href="https://docs.oracle.com/cd/B28359_01/server.111/b28278/e900.htm#ORA-00910" target="_blank"&gt;https://docs.oracle.com/cd/B28359_01/server.111/b28278/e900.htm#ORA-00910&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Other sources for troubleshooting: &lt;A href="https://www.techonthenet.com/oracle/errors/ora00911.php" target="_blank"&gt;https://www.techonthenet.com/oracle/errors/ora00911.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But, you should post your code so others can look and troubleshoot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 01:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1053035#M60957</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2021-04-30T01:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cleaning Up Query Layers</title>
      <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1053391#M60970</link>
      <description>&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;Yes, last night I determined that the error was loosely coupled with the Delete call.&amp;nbsp; If I skipped the Delete call on my query table and just ignored cleaning it up, a later call to Delete in the script fails with the same error.&amp;nbsp; The later call involves an in memory feature class that has nothing to do with Oracle at all.&amp;nbsp; It is like the issue is floating around somewhere waiting to come out when Delete is called.&amp;nbsp; It feels like a bug.&amp;nbsp; I did simplify the code down tremendously and I still get the issue:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import arcpy

arcpy.management.MakeQueryLayer(
    "WAM_PROD.sde",
    "PMQueryTable",
    "SELECT * FROM sa_pm_master",
    oid_fields="PM_MASTER_NO"
)

arcpy.management.Delete("PMQueryTable")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still get the exact same error and that is the simplest SQL query I can make.&amp;nbsp; There might be something I am missing here, but this seems buggy.&amp;nbsp; At the least, it would be nice if the error did not show up on an unrelated in memory feature class.&amp;nbsp; Still, I think it has something to do with arcpy's management of these in memory objects.&amp;nbsp; Also, it might be somehow related to user permissions.&amp;nbsp; This user has minimal permissions.&lt;/P&gt;&lt;P&gt;I did find that if I Describe the query table after deleting it, it is gone.&amp;nbsp; I can delete it a second time without error.&amp;nbsp; I might just catch and ignore the exception.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 19:25:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1053391#M60970</guid>
      <dc:creator>NathanHeickLACSD</dc:creator>
      <dc:date>2021-04-30T19:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cleaning Up Query Layers</title>
      <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1153455#M64041</link>
      <description>&lt;P&gt;Nathan, did you find a solution to this?&amp;nbsp; Similarly, I export an Oracle table to a local file geodb table and when trying to delete, it throws the same error.&amp;nbsp; The table is completely resident in the file geodb and unrelated to the original Oracle table at that point.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 18:20:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1153455#M64041</guid>
      <dc:creator>Scott_T_Anderson</dc:creator>
      <dc:date>2022-03-14T18:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cleaning Up Query Layers</title>
      <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1153462#M64042</link>
      <description>&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;Esri Technical Support eventually registered what I described as a bug.&amp;nbsp; I'm not sure that your situation is the same problem.&amp;nbsp; I would talk to Technical Support if you want to find a resolution.&amp;nbsp; I spent a long time just getting to the bug declaration.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 18:31:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1153462#M64042</guid>
      <dc:creator>NathanHeickLACSD</dc:creator>
      <dc:date>2022-03-14T18:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cleaning Up Query Layers</title>
      <link>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1153464#M64043</link>
      <description>&lt;P&gt;Thank you Nathan, have a great day! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 18:32:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cleaning-up-query-layers/m-p/1153464#M64043</guid>
      <dc:creator>Scott_T_Anderson</dc:creator>
      <dc:date>2022-03-14T18:32:28Z</dc:date>
    </item>
  </channel>
</rss>

