Select to view content in your preferred language

Batch Trace Script: ExecuteError: 'in-table' is not table or a featureclass

217
8
Saturday
MichaelParma
Regular Contributor

Greetings,

I'm trying to run a batch trace via script in an attempt to speed up processing time on nearly 50,000 records outside of a map, writing summary statistics back to a text field. This is in a FGDB UN with attribute rules disabled. The trace configuration works fine individually and when executed from the Batch Trace dialogue. It fails when this is run from a Python Notebook.

My code:

arcpy.ImportToolbox(r"C:\Path\To\My\UtilityDataManagementSupport_33.atbx", "udms")
arcpy.udms.BatchTrace(
in_utility_network=r"C:\Path\To\My.gdb\Water\UtilityNetwork",
trace_locations=r"C:\Path\To\My.gdb\Water\WaterLine",
result_types="CALCULATE",
trace_config="Trace Config:: Isolating Features",
expression="ASSETGROUP = 1 and AssetType IN (0, 1, 2) and OBJECTID < 6", #OBJECTID is only for testing purposes
output_folder=None,
key_field="GLOBALID",
summary_store_field="analyticnotes",
fields=None,
calc_on_start="UPDATE_START_ROWS",
history_field=None,
default_terminal_id=None,
code_block=""
)

Executing this results in: 

ExecuteError: 'in_table' is not a table or a featureclass

In the traceback, I find this line which leads me to believe it might be related to the summary_store_field, though this field exists in the WaterLine feature class.

File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\udms\logic\un_trace.py", line 1291, in update_starting_points_with_summaries
    logger.exception(e, stack_info=True)

Any thoughts are appreciated!

0 Kudos
8 Replies
JoshuaBixby
MVP Esteemed Contributor

How about posting the entire trackback?

0 Kudos
MichaelParma
Regular Contributor

The entire traceback:

ExecuteError: 'in_table' is not a table or a featureclass
Traceback (most recent call last):
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\udms\logic\un_trace.py", line 1284, in update_starting_points_with_summaries
with arcpy.da.UpdateCursor(
^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: 'in_table' is not a table or a featureclass
Stack (most recent call last):
File "<string>", line 2, in <module>
File "[3]", line 3, in <module>
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx", line 1287, in BatchTrace
×٠䬡„ žÅQk Uþr.®E“ƒäA\²ç 6ud¬n ƒ
Í›1Hû @ҍ¬M 
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\BatchTrace.tool\tool.script.execute.py", line 23, in <module>
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\udms\esri.py", line 547, in wrapper
f = func(*args, **kwargs)
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\udms\logic\__init__.py", line 232, in batch_trace
return ts.main(
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\udms\logic\un_trace.py", line 835, in main
self.update_starting_points_with_summaries(sum_df)
File "C:\Path\To\My\UtilityDataManagementSupport_33.atbx\udms\logic\un_trace.py", line 1291, in update_starting_points_with_summaries
logger.exception(e, stack_info=True)
Failed to execute (BatchTrace).

0 Kudos
PierreloupDucroix
Frequent Contributor

I think the trace_locations parameter in the batchTrace tool should reference a feature layer compatible with the starting_points parameter from the arcpy trace tool, ie. a starting_point feature class : https://pro.arcgis.com/en/pro-app/3.3/help/data/utility-network/starting-points.htm

Did you try building your starting points with the BuildStartingPoints tool from the UDMS toolbox ?

https://esri.github.io/Utility-Data-Management-Support-Tools/docs/3.1/BuildStartingPoints.html

 

CEO of MAGIS
MichaelParma
Regular Contributor

I have not tried the BuildStartingPoints tool. I was trying to convert the Python directly provided from the the BatchTrace dialogue and figured it might be making that conversion for me. 

0 Kudos
gis_KIWI4
Frequent Contributor

@MichaelParma  - While the error doesn't suggest directly that this is the issue, I think @PierreloupDucroix might be onto something.
The starting point table has a unique schema. 

gis_KIWI4_0-1751318664774.png

Your script suggests you are pointing to the feature class directly. 
If you're passing in a regular feature class (e.g., WaterLine) directly, it may not have the required schema for trace locations.

Instead, you often need to use a prepared Trace Locations table, which is generated using the Add Trace Locations tool.

Maybe that fixes it. 

 

 

MichaelParma
Regular Contributor

Ok, that's does make sense. I think I'll carve out some time to give that a try this afternoon and report back.

0 Kudos
RobertKrisher
Esri Regular Contributor

You can find a video of the end-to-end process for configuring batch trace in the GitHub repo for the tool: esri.github.io/Utility-Data-Management-Support-Tools/help/BatchTrace.mp4

You can see that the tool requires you to select a starting point layer created by the Build Starting Points tool.

0 Kudos
MichaelParma
Regular Contributor

Thanks, Robert. I was unaware of that video. Looks like that's next on my to do list.

0 Kudos