I'm using arcpy.management.MakeQueryLayer to run a SQL statement in an Oracle database and return a table. 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. If I were in ArcGIS Pro, it would create a table view, so I feel like I should clean up after myself. 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:
arcgisscripting.ExecuteError: Underlying DBMS error[ORA-00911: invalid character
ORA-00911: invalid character] Underlying DBMS error[ORA-00911: invalid character
ORA-00911: invalid character]
This seems kind of strange to me why Oracle would be involved. I did try saving the result of MakeQueryLayer and then using del on the arcpy._mp.Table object. It did delete the object and when I try to read the query layer again using its name, arcpy no longer recognizes it. Still, I'm wondering if this is the correct approach.