I have problems in ArcGIS Pro 2.8 notebooks with a where clause of two long fields of a file geodatabase feature class (FID fields after union):
where_clause_1 = '("FID_outBarriereBuffer" = -1 AND "FID_Nutzung_Weide" > -1)'
arcpy.analysis.Select(inBarriere, outWeide, where_clause_1)
With this I get the following message:
ExecuteError: ERROR 000358: Ungültiger Ausdruck ("FID_outBarriereBuffer" = -1 AND "FID_Nutzung_Weide" > -1)
Fehler beim Ausführen von (Select).
Any ideas for a solution?
Solved! Go to Solution.
I would do the query manually to and copy the snippet to make sure the right sql variant is used for the inputs
Select (Analysis)—ArcGIS Pro | Documentation
If I use select layer by attribute and copy feature there is no problem?
arcpy.management.MakeFeatureLayer(outUnion, outUnionLayer)
arcpy.management.SelectLayerByAttribute(outUnionLayer, 'NEW_SELECTION',
'"FID_Nutzung_Weide" > -1 And "FID_outBarriereBuffer" = -1')
arcpy.management.CopyFeatures(outUnionLayer, outWeide)
I would do the query manually to and copy the snippet to make sure the right sql variant is used for the inputs
Select (Analysis)—ArcGIS Pro | Documentation
Thank you for your good idea. It leads then to something like this (if I build a model and export to python):
arcpy.analysis.Select(in_features=outUnion, out_feature_class=outUnion_Select, where_clause="FID_Nutzung_Weide > -1 And FID_outBarriereBuffer = -1")
but doesn't work in the notebook.
Think I will use the select by attribute + copy feature solution to get to an end ...
Maybe try it without the ( ).
you are right the () are useless, I put them in out of despair because without it doesn't work as well 🙂