<?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: Query Oracle Table -- Need advice in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686268#M53095</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this will help or hurt, but instead of Createfeatureclass_management like you are doing, why not create a table (CreateTable_management) and use your sdeReturn to populate it?&amp;nbsp; Then use that table in the arcpy.MakeXYEventLayer_management, which a table is the parameter it is asking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006z000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006z000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: forgot --- this would mean you don't need cx_Oracle at all.&amp;nbsp; How is the performance of ArcSDESQLExecute?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Feb 2013 16:48:59 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2013-02-08T16:48:59Z</dc:date>
    <item>
      <title>Query Oracle Table -- Need advice</title>
      <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686265#M53092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Task: query a very large Oracle table, build an XY Event layer, apply symbology with .lyr file, create GP service, and output to web app using web API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have this running using ModelBuilder at AGS v10 in a GP service and a JSAPI web app.&amp;nbsp; I am now trying to upgrade to Python and a Python Toolbox.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Desktop 10.1 SP1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Server Linux 10.1 SP1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcSDE 10 SP2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Oracle 11.2.0.2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My biggest question is how best to query the data in Oracle (I'm looking for performance).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use TableSelect_analysis through an ArcSDE connection file in my older ModelBuilder GP service, but I only want 4 columns from this table and it has 21.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MakeTableView_management through an ArcSDE connection file doesn't honor my where clause or my fieldinfo (ESRI Support is looking into this).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can execute my SQL query with ArcSDESQLExecute, but I'm not sure how to handle the list to use with MakeXYEventLayer_management.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also read that using cx_Oracle is a good way to go.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was hoping that you gurus out there might give me some advice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 12:15:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686265#M53092</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2013-02-08T12:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Query Oracle Table -- Need advice</title>
      <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686266#M53093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Glen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have several Geoprocessor implementations that use cx_Oracle to pull in attribute data for processing and it works very well for us.&amp;nbsp; The datasets that must be processed are large (15 minute sample collections over several years), so since we can issue SQL thru the cx_Oracle we only return the results that are needed over each iteration (date).&amp;nbsp; That is, instead of having to chug through an entire huge dataset, we simply return what is needed, process it, then move on to the next result that is needed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The trickiest part to get right was making the cx_Oracle cursor (the resulting rows from the SQL) compatible with ESRI-related data.&amp;nbsp; Specifically, this means we must build an empty data container (table) on the GIS side of things and then populate it with the results in the cx_Oracle cursor.&amp;nbsp; This of course means it is a field mapping issue, but I think all-in-all it really isn't that difficult to get right.&amp;nbsp; Once you get the result into an ESRI table format of your choosing, you can then process your XY Event theme as normal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example of doing this field mapping and populating the in_memory table:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.createtable_management("IN_MEMORY", "TempDT", "", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cxRows = cursor.fetchall()&amp;nbsp; #the cursor here was already filled.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowcount = cursor.rowcount
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in range(1, rowcount - 1):
 
&amp;nbsp; tables = gp.ListTables()
&amp;nbsp; for tbl in tables:&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if tbl=="TempDT":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ### add the fields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in range(0, len(cursor.description)):
&amp;nbsp;&amp;nbsp; val1 = str(cursor.description&lt;I&gt;[0])
&amp;nbsp;&amp;nbsp; val2 = str(cursor.description&lt;I&gt;[1])
&amp;nbsp;&amp;nbsp; val3 = str(cursor.description&lt;I&gt;[2])

&amp;nbsp;&amp;nbsp; if val2=="&amp;lt;type 'cx_Oracle.STRING'&amp;gt;":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldType = "Text"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val3 = cursor.description&lt;I&gt;[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField(tbl, str(cursor.description&lt;I&gt;[0]), fldType, val3)


&amp;nbsp;&amp;nbsp; if val2=="&amp;lt;type 'cx_Oracle.NATIVE_FLOAT'&amp;gt;":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldType = "Float"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField(tbl, str(cursor.description&lt;I&gt;[0]), fldType)


&amp;nbsp;&amp;nbsp; if val2=="&amp;lt;type 'cx_Oracle.DATETIME'&amp;gt;":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldType = "Date"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField(tbl, str(cursor.description&lt;I&gt;[0]), fldType)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ### now populate the table
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insRows = gp.InsertCursor(tblNew)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for cxRow in cxRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insRow = insRows.newRow()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in range(0, len(cursor.description)):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insRow.setvalue(str(cursor.description&lt;I&gt;[0]), cxRow&lt;I&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insRows.insertRow(insRow)



&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.close() 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.close()&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:51:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686266#M53093</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T04:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query Oracle Table -- Need advice</title>
      <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686267#M53094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply James.&amp;nbsp; I will definitely give cx_Oracle a try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I am doing with ArcSDESQLExecute:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os
from arcpy import env
import sys
import time

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; t0 = time.clock()
&amp;nbsp;&amp;nbsp;&amp;nbsp; env.workspace = r"C:\ags\python"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sdeConn = arcpy.ArcSDESQLExecute(r"C:\ags\gp\gisselect_cdodb_t.sde")

&amp;nbsp;&amp;nbsp;&amp;nbsp; sql = "SELECT lon, lat, snow FROM gis.snow_sum_partitioned WHERE date_time = to_date('19991231','yyyymmdd') AND snow IS NOT NULL"

&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # execute SQL statement
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdeReturn = sdeConn.execute(sql)
&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception, ErrorDesc:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ErrorDesc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdeReturn = False

&amp;nbsp;&amp;nbsp;&amp;nbsp; # if return value is a list (a list of lists), display each list as a row from the table being queried.
&amp;nbsp;&amp;nbsp;&amp;nbsp; if isinstance(sdeReturn, list):

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set spatial reference
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prjFile = "geo_wgs84.prj"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spatialRef = arcpy.SpatialReference(prjFile)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmpWorkspace = "in_memory"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outXYfc = "XY_FeatureClass"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create in_memory empty feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(tmpWorkspace, outXYfc , "POINT", "", "", "", spatialRef)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # build tmp FC path and add new field for values to interpolate
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmpFC = os.path.join(tmpWorkspace, outXYfc)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(tmpFC, "Snow", "DOUBLE")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create insert cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inCur = arcpy.InsertCursor(tmpFC)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for rec in sdeReturn:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point(rec[0], rec[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = inCur.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Shape = pnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Snow = rec[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inCur.insertRow(row)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del inCur, row

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set layer symbology
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; symbology_layer = "snow_symbology.lyr"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management(outXYfc, symbology_layer)

&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # If the return value was not a list, the statement was most likely a DDL statment. Check its status.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if sdeReturn == True:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "SQL statement: " + sql + " ran sucessfully."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "SQL statement: " + sql + " FAILED."

except Exception, ErrorDesc:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print Exception, ErrorDesc
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Problem executing SQL."

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686267#M53094</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2021-12-12T04:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Query Oracle Table -- Need advice</title>
      <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686268#M53095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this will help or hurt, but instead of Createfeatureclass_management like you are doing, why not create a table (CreateTable_management) and use your sdeReturn to populate it?&amp;nbsp; Then use that table in the arcpy.MakeXYEventLayer_management, which a table is the parameter it is asking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006z000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006z000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: forgot --- this would mean you don't need cx_Oracle at all.&amp;nbsp; How is the performance of ArcSDESQLExecute?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 16:48:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686268#M53095</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-02-08T16:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Query Oracle Table -- Need advice</title>
      <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686269#M53096</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;As far as performance with ArcSDESQLExecute goes, my entire script consistently takes ~7.5s while the query is returned in ~2.4s (~0.8s for the connection, ~1.6s for the query) -- while changing dates to avoid query caching as well as to use different table partitions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The time hog is looping through the records to create the featureclass (~4s).&amp;nbsp; For this reason, I'll look into using CreateTable_management and MakeXYEventLayer_management to see if going that route improves performance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 11:31:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686269#M53096</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2013-02-12T11:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Query Oracle Table -- Need advice</title>
      <link>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686270#M53097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Glen -- something that completely slipped my thought process for this thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What if your Database repository is NOT ArcSDE?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is where and why cx_Oracle is needed for our implementation.&amp;nbsp; That is, we are integrating non-spatial Oracle attirbute repositories (ancillary to spatial databases), joining this data in the in_memory space to "make it" spatial data, then processing it from there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that makes sense.&amp;nbsp; Again, if your attributes are stored in SDE then your ArcSDESQLExecute is probably a good choice --- I really have no benchmark to comment on performace differences between this and cx_Oracle.&amp;nbsp; I'd gather if I moved my SQL into procedural packages on the database server I could really boost things up (but even that may be negligable gains).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway -- good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 13:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-oracle-table-need-advice/m-p/686270#M53097</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-02-12T13:41:24Z</dc:date>
    </item>
  </channel>
</rss>

