I am trying to join a SDE feature class to a Query Layer via Python. I don't seem to have any issues doing this manually in ArcMap, but everytime I get to the join portion of my script, it fails with ERROR: 000229. I've turned off Background Geoprocessing. That doesn't seem to help. I've tried a few ways of accessing the query table in the join function, but it always returns the same error message (tried using "Describe" to grab the name of the query table, tried to use the "ake Table View" function on the query layer, none of which seems to work)
import arcpy from arcpy import env env.workspace = r"Database Connections\PRD.sde" # Local variables: PRD_sde = "Database Connections\\PRD.sde" query = "My query" # This is a bonified and varified query. It's just a little large for this post # Process: Make Feature Layer arcpy.MakeFeatureLayer_management("SPATIAL.TENURE_SVW", "selected_tenures", "TENURE_NUMBER_ID in (216720,216721,216722,216723,216724,216725)", "") # Process: Make Query Layer arcpy.MakeQueryLayer_management(PRD_sde, "Table_Test", query, "TENURE_NUMBER_ID", "", "", "") # Process: Add Join arcpy.AddJoin_management("selected_tenures", "TENURE_NUMBER_ID", "Table_Test", "TENURE_NUMBER_ID", "KEEP_ALL") dddd
This line is hard to find
and it is not restricted to background geoprocessing and see this
here are some of the causes
This error message displays when the following occurs:
• The data is inaccessible, unavailable, or invalid.
• There are unsupported data types in 64-bit background processing.
• Unsupported tools are unable to run in background processing.
• The 64-bit background geoprocessing does not have the necessary 64-bit libraries.
When background processing is turned on, scripts execute using 64-bit background processing. ArcMap is unable to read data types not supported by 64-bit background processing, while tools incapable of running in the background cannot leverage 64-bit processing. By default, ArcMap and ArcCatalog communicate through a 32-bit client library.
And it comes up a lot with python and modelbuilder and SDE and other network based file locations. That could be one reason why 'stuff' works within arcmap with the tools in arctoolbox, but fails as a python script. So, I would run some checks and printouts to ensure that the file can actually be found.