<?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: Python scripts that update SDE Layers with NWS local storm report data in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-scripts-that-update-sde-layers-with-nws/m-p/200201#M15383</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where you ever able to solve this mystery.&amp;nbsp; I had used them on 9.3 and 10.0 spectacularly. I changed jobs and did not have to use them until now.&amp;nbsp; I am using the same scripts and am having some difficulty running them on 10.2.2.&amp;nbsp; I have changed arcgisscripting to arcpy in the code.&amp;nbsp; Any additional comments/suggestions are welcome. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Mar 2015 22:02:47 GMT</pubDate>
    <dc:creator>ChristinaMcCullough</dc:creator>
    <dc:date>2015-03-03T22:02:47Z</dc:date>
    <item>
      <title>Python scripts that update SDE Layers with NWS local storm report data</title>
      <link>https://community.esri.com/t5/python-questions/python-scripts-that-update-sde-layers-with-nws/m-p/200200#M15382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if this is an SDE question or a python question, but here goes...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been using some python code since late 2009 that was written by John Karagiannis when he was with ESRI.&amp;nbsp; I use the set of scripts that updates a SDE feature class with downloaded National Weather Service's local storm report data.&amp;nbsp; It is run every 30 minutes and is utilized in our FLEX Situational Awareness application.&amp;nbsp; The number of records is NOT large - usually under 100 unless there is a lot of bad weather.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Up until our ArcGIS/ArcSDE upgrade to 10 in April, the script would take 10-20 seconds to run.&amp;nbsp; After the upgrade to 10, I altered the python code to use arcpy instead of gp.&amp;nbsp; All seemed to work okay.&amp;nbsp; But I didn't realize that slowly since April, the time it takes for the script to run reached 18 minutes (for 93 records).&amp;nbsp; Plus I realized that it takes a LONG time to access the feature class in Catalog.&amp;nbsp; Plus it is taking a long time to display in Flex. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had another copy of the feature class in a TEST database (that would still connect quickly in Catalog) and I tried running the script against it.&amp;nbsp; It still took a lot longer than 10 seconds.&amp;nbsp; Plus, when I set it to run every 30 minutes, the time to process started creeping up higher and higher.&amp;nbsp; After a while, it was again taking longer to connect to the layer in Catalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea what is happening and why the switch to 10 changed it all??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;More background:&amp;nbsp; This script(s) access a url at Iowa State, downloads a shapefile and saves it locally.&amp;nbsp; Then, it accesses a SDE feature class, deletes all the existing records and appends the new records from the shapefile.&amp;nbsp; This is the portion of the module that does the data load - this is where I see the slow down.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(dst contains the string to the SDE feature class that is unversioned)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def load_data(src, dst):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(src):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(dst):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&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; #delete the features from the sde feature class
&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; print "before delete"
&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; arcpy.DeleteFeatures_management(dst)
&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; print "after delete"
&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; #append the new features from the shapefile to the sde feature class
&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; #print "here"
&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; arcpy.Append_management(src, dst, 'NO_TEST', '')
&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; print "after Append"
&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; write_to_log('&amp;nbsp; Processed ' + src + ' to ' + dst)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&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; write_to_log('&amp;nbsp; Error Processing ' + src + ' to ' + dst)
&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; write_to_log('&amp;nbsp; ' + arcpy.GetMessages(2))
&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; write_to_log('&amp;nbsp; SDE feature class ' + dst + ' does not exist')
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write_to_log('&amp;nbsp; Shape file ' + src + ' does not exist')&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help you can provide.&amp;nbsp; Maybe someone else is using these same scripts out there since they weren't created just for us!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 15:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-scripts-that-update-sde-layers-with-nws/m-p/200200#M15382</guid>
      <dc:creator>CarmenDurham</dc:creator>
      <dc:date>2012-08-23T15:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripts that update SDE Layers with NWS local storm report data</title>
      <link>https://community.esri.com/t5/python-questions/python-scripts-that-update-sde-layers-with-nws/m-p/200201#M15383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where you ever able to solve this mystery.&amp;nbsp; I had used them on 9.3 and 10.0 spectacularly. I changed jobs and did not have to use them until now.&amp;nbsp; I am using the same scripts and am having some difficulty running them on 10.2.2.&amp;nbsp; I have changed arcgisscripting to arcpy in the code.&amp;nbsp; Any additional comments/suggestions are welcome. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 22:02:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-scripts-that-update-sde-layers-with-nws/m-p/200201#M15383</guid>
      <dc:creator>ChristinaMcCullough</dc:creator>
      <dc:date>2015-03-03T22:02:47Z</dc:date>
    </item>
  </channel>
</rss>

