Make Query Table - ERROR 000152: Invalid input data

7180
5
04-18-2013 12:54 PM
by Anonymous User
Not applicable
Original User: sstrand@ocwd.com
Original Date: 2013-04-18T13:54:51-0600

I am trying to use the Make Query Table to join two tables in a one to many situation.

I don't want to link the entire script because it is huge. Here is the piece of code within the larger script:

sqltable = "sqltable_" + InfoRequestNum
inList = ["wellresult","westbays"]
wellsList = ["wellresult.STAID1_T","wellresult.STAID2_T","westbays.STAID4"]
arcpy.MakeQueryTable_management(inList, sqltable, "USE_KEY_FIELDS", wellsList, "", "")


Some info about the script:
Everything is taking place in a file geodatabase.
wellresult is a point featureclass
westbays is a table
Each point has a STAID1_T but there are multiple STAID4 that relate to one STAID1_T
The output should be sqltable.

The error:
ERROR 000152: Invalid input data
0 Kudos
5 Replies
JamesCrandall
MVP Frequent Contributor
This may be a silly question, but did you set the env.workspace? Does the workspace actually have "wellresult" and "westbays" in it and are they tables in the FGDB?

Sorry if this throws you off in the wrong direction, but that's the first thing I'd double-check.

j

I am trying to use the Make Query Table to join two tables in a one to many situation. 

I don't want to link the entire script because it is huge. Here is the piece of code within the larger script: 

sqltable = "sqltable_" + InfoRequestNum
inList = ["wellresult","westbays"]
wellsList = ["wellresult.STAID1_T","wellresult.STAID2_T","westbays.STAID4"]
arcpy.MakeQueryTable_management(inList, sqltable, "USE_KEY_FIELDS", wellsList, "", "")


Some info about the script:
Everything is taking place in a file geodatabase. 
wellresult is a point featureclass 
westbays is a table 
Each point has a STAID1_T but there are multiple STAID4 that relate to one STAID1_T 
The output should be sqltable. 

The error:
ERROR 000152: Invalid input data
0 Kudos
by Anonymous User
Not applicable
Original User: SStrand

Yes, the env.workspace is a file geodatabase that contains wellresult (which is a point feature class) and westbays (which is a table). If you are saying both need to be tables, I will try adding in a conversion to get the wellresult as a table only and see how it goes.

I've also changed up the code a bit, as I've found that the brackets are for personal geodatabases only, and I need things in quotes instead. Going off that help, the code currently looks like this:

sqltable = "sqltable_" + InfoRequestNum
inList = "westbays;wellresult"
wellsList = "wellresult.STAID1_T", "STAID1_T";"wellresult.STAID2_T", "STAID2_T";"westbays.STAID4", "STAID4"
arcpy.MakeQueryTable_management(inList, sqltable, "NO_KEY_FIELD", "STAID1_T", wellsList, "")


This may be a silly question, but did you set the env.workspace?  Does the workspace actually have "wellresult" and "westbays" in it and are they tables in the FGDB?

Sorry if this throws you off in the wrong direction, but that's the first thing I'd double-check.

j
0 Kudos
MichaelVolz
Esteemed Contributor
Unless I'm reading something wrong, the documentation at the below link says Query layers will only work with enterprise databases.  A file geodatabase is not a valid input workspace.

http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000174000000

I hope this does not cause problems to get this data into SDE.
0 Kudos
by Anonymous User
Not applicable
Original User: SStrand

You linked a different tool which, yes, only works with SDE. Make Query Table does work with file geodatabases though:

http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000006r000000

Unless I'm reading something wrong, the documentation at the below link says Query layers will only work with enterprise databases.  A file geodatabase is not a valid input workspace.

http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000174000000

I hope this does not cause problems to get this data into SDE.
0 Kudos
MichaelVolz
Esteemed Contributor
Sorry about that.  I copied your script call to MakeQueryTable_management in Google, but I did not pay enough attention that it found MakeQueryLayer_management instead.

I would suggest simplifying your call to MakeQueryTable_management to get it working and then add your more complex calls one-by-one until you find out what the current problem is.

I would also suggest some sort of logging or print statements to see if your variables are getting populated as expected.
0 Kudos