I have a Python script which runs on a SDE feature class daily (as a scheduled task). I would actually like this script to run whenever a new row is added to the feature class (data is captured in the field using a mobile device and posted to the server).
I was considering using a trigger as mentioned in this question as my data is not versioned, but I do not want to overcomplicate things if there is an inbuilt SDE tool which can achieve this or something similar. The data is currently stored in ArcSDE 10/SQL Server 2008, but I do have ArcSDE 10.1/SQL Server 2012 available.
Currently when the script runs, it checks for NULL
values in a certain field. If it finds it, it selects those rows and performs several geoprocessing operations on them. It then populates that field with a value to show that everything has been processed.
While I have a lot of experience editing/reconciling/posting/versioning SDE data, I only have limited experience with the database/admin side of it (assigning privileges, basic dabbling in SQL management studio), with a basic understanding of the underlying architecture.
Best Answer
First of all: No, SDE does not have any built in feature of event triggered processing. As far as I know you can probably do something working with the CASE Tools where you can implement your own types of featureclasses with their own behaviour, but that means ArcObjects programming.
I think database triggers can be used for this, and this wouldn't be too complicated, but as mentioned here calling a rather big piece of software (like a python/arcpy script) out of a database trigger (meant to be minimalistic) brings you a couple of things, you should at least think of:
I guess the best will be, to keep your script running periodically, but to shorten the time period to only some minutes. Add a table where you can store flags which indicate a change in your Featureclass. Use a database Trigger to set the "changed" flag. Modify your script to run only if the changed flag is set, or if not then simply quit.
This way, your script will fill your data in short periods of time without running into raceconditions.
You can read here how you activate and use system calls in sql server triggers (although the example is for PHP, but thats just anoter interpreter).
Also read through all disadvantages the authors are mentioning.