AnsweredAssumed Answered

From modelbuilder featureset to python

Question asked by SimonWebster.QFES on Jul 2, 2019

I'm looking for some advice - I'm collecting polygon data via a featureset in model builder. This works. Next, I'd like to use the collected polygon geometry in python to query SQL. In order to work with the featureset I've found I typically have to run a featureclass to featureclass with the result being in_memory\input_poly. 

 

How can I take an in_memory feature class from model builder and use it in python without writing it to a file? Is it even possible? I'm trying to eliminate file writes where I can to keep the speed of the process up as it will eventually be attached to a feature service (which requires a model builder wrapper) that users will be waiting on. 

 

As an alternative, if I could make SQL requests to an SDE database from within a modelbuilder tool I'd try that too - but from experience, I'm far better off feeding a carefully constructed query out of python. 

Outcomes