2

I've been building some software that reads/writes spatial and non-spatial data out of our SQL SDEs dynamically when called. As I've pointed out before Time Delay in Importing ArcPy , ArcPy takes forever to import. This has become an issue with my users as the querying and writing tools are too slow for their day to day use.

I am reading and writing data to tables and spatial features within the SDEs using ArcPy cursors (search, update). I've found that cursors work best for the reading and writing of data within SDEs, but I am hoping there is a quicker way without ArcPy.

5
  • 1
    arcpy is only slow to import the first time. It's unclear as to why you would need to do this multiple times in a single app. Your data is in SQL Server, not SDE (which no longer exists). There are many ways to access data in a database that don't involve ArcPy, but they all have costs as well as benefits.
    – Vince
    Aug 24, 2018 at 14:16
  • @Vince The app is web based and builds a web page based on a query. Arcpy is called for each query, it's not running at all times in the background. Importing arcpy adds a solid 3-10 seconds for the query.
    – Cody Brown
    Aug 24, 2018 at 14:20
  • That's an application architecture failure. The app should be running in the background at all times, though doing this without an ArcGIS Server seat is probably a violation of the Desktop license terms.
    – Vince
    Aug 24, 2018 at 14:23
  • @Vince Hmm, I like your idea. My web app is mostly static. User logs in / views datasets / selects dataset / performs query. At the query step is the only time ArcPy is called (that and if they update data). It may be a good idea to have an app running server side, with ArcPy loaded waiting for the queries and updates. Hadn't really considered this as obvious as it seems. Thanks for the input. We do have ArcGIS server, so no licensing issues.
    – Cody Brown
    Aug 24, 2018 at 14:27
  • 1
    @CodyBrown That app running server side would be ArcGIS Server ;-)
    – Berend
    Aug 24, 2018 at 14:41

1 Answer 1

3

Depending on which ArcGIS software you have installed you have different options:

A different approach would be to use SQL directly. I wouldn't recommend it for complex database operations, but simple insert/update/delete should work. The most important thing to remember is to use the sde.next_rowid stored procedure to generate an Object ID for new records. Do not try to generate one by calling MAX(ObjectID) + 1 or something similar. Updating the geometry field depends on the exact type of that field (ST_Geometry, SDE_Geometry, ...)

2
  • 1
    ArcObjects sadly is not an option, ArcServer is though I am shall try it. I've never heard of the Pro SDK though, that is an interesting option.
    – Cody Brown
    Aug 24, 2018 at 12:53
  • 1
    I forgot about the ArcGIS Server REST endpoint, will update shortly
    – Berend
    Aug 24, 2018 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.