kenrus

arcpy methods / functions and SDE connections

Discussion created by kenrus on Feb 7, 2013
I have a stand alone python script that runs under arcgis server using the arcpy interface.

Basically this script contains a primary loop where it:
1. Selects first/next U.S. State
2. Compiles a list of addresses for the given state
3. geocodes the addresses
4. go to step 1

This script works fine for several states, but when it gets to a state that takes significantly longer to geoprocess than the average, the next arcpy function that is called throws an exception that the database table doesn't exist or is not supported.

Since this loop works for several states and only throws an exception when a longer period of time elapses between function calls, I am wondering if there is some time-out occuring that is enforced by either some setting in arcpy or on the server.

My first question is:
When using arcpy in a stand alone script, does the first function to open an SDE connection close it or does it leave it open until the script finishes?

For example:
When my script calls ... arcpy.CopyRows_management("C:\\dbconn\\mydb.sde", strTableName, "") ... is the connection opened and closed inside the function or is the connection opened and left opened until the end of the script?

Outcomes