I am having a similar issue running
arcpy.MakeQueryTable_management (['XYfeatureTable'], "q92","ADD_VIRTUAL_KEY_FIELD","",[["XYfeatureTable.EHANDLE"]],"")
The function executes and it has done something, because if I try to run it again with out changing the "q92" to something else, it tells me that it can't run (this second time) because "q92" already exists. I've tried to access this result several ways without success.
Unfortunately, I am running 10.2.2.3552 and it seems that arcpy.gp.MakeQueryTable_management
does not exist in this version.
Just highlighted just as a test of GeoNet. I did this by pasting the code, selecting the code, picking the advanced editor (upper right), selecting >> icon, syntax highlighting -> Python.
import arcpy, datetime, arcgisscripting, os from arcpy import env # Local variables. tableList = "Database Connections/Database.odc/FWS_WMIS.FWI_INVENTORY_PROJECT;Database Connections/Database.odc/FWS_WMIS.FWI_INVENTORY_SURVEY" fieldList = "FWS_WMIS.FWI_INVENTORY_PROJECT.INV_PROJ_ID 'INVENTORY_PROJECT_ID';FWS_WMIS.FWI_INVENTORY_SURVEY.INV_SURVEY_ID 'INV_SURV_ID';FWS_WMIS.FWI_SURVEY_CREW_FNC(FWS_WMIS.FWI_INVENTORY_SURVEY.INV_SURVEY_ID) 'SURVEY_CREW'" whereClause = "FWS_WMIS.FWI_INVENTORY_PROJECT.INV_PROJ_ID=FWS_WMIS.FWI_INVENTORY_SURVEY.INV_PROJ_ID AND FWS_WMIS.FWI_INVENTORY_PROJECT.INV_PROJ_ID=17909" keyField = "FWS_WMIS.FWI_INVENTORY_PROJECT.INV_PROJ_ID" #Get the current date and time. now = datetime.datetime.now() #Use the current time as the name for the layer to produce a unique name for every layer. lyrName = now # Make Query Table. arcpy.gp.MakeQueryTable_management(tableList, lyrName,"USE_KEY_FIELDS", keyField, fieldList, whereClause)
This looks a little buggy. I'm wondering if the fieldList were constructed as a Python list whether it would parse correctly using the normal interface (not going through the old "gp" module connection).
Sorry for the slow reply. Things got busy.
I got it figured out and the on-line examples are not clear.
This doesn't work:
arcpy.MakeQueryTable_management(tableList, lyrName,"NO_KEY_FIELD", keyField, fieldList, whereClause)
This works:
arcpy.gp.MakeQueryTable_management(tableList, lyrName,"NO_KEY_FIELD", keyField, fieldList, whereClause)
The only difference is the "gp".
As I said, maybe this is simple, but it sure wasn't obvious to me. Thanks for everyone who spent time on this one.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.