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 featureclassIn 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!
How about posting the entire trackback?
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).
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
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.
@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.
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.
Ok, that's does make sense. I think I'll carve out some time to give that a try this afternoon and report back.
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.
Thanks, Robert. I was unaware of that video. Looks like that's next on my to do list.
I am experiencing a similar issue. When working with the data in a Mobile Geodatabase, I can run the Batch Trace Calculate using the same trace configurations without any errors.
However, when I try to run the same data model through a web service backed by Oracle 19c, I encounter this error.
Have you gained any experience with this issue?
PS:
The data schema is the same as in the mobile geodatabase, and no parameters or settings have been changed.
arcpy.ImportToolbox(r"D:\...\UtilityDataManagementSupport_3_5).atbx")
arcpy.udms.BatchTrace(
in_utility_network="L8Network_Utility_Network Utility Network",
trace_locations=r"D:\...\Test.gdb\UN_Temp_Starting_Points",
result_types="CALCULATE",
trace_config="Trace Config:: Adresses",
expression="",
output_folder=None,
key_field=None,
summary_store_field="",
fields="Test 'Electric Device' UNTest",
calc_on_start="SKIP_START_ROWS",
history_field=None,
default_terminal_id=6,
code_block=""
)ArcGIS Pro 3.6.1.59527
udms 3.5
Executing from ArcGIS Pro, 1 map(s), activeMap = True
Traceback (most recent call last):
File "D:\...\UtilityDataManagementSupport_3_5).atbx\BatchTrace.tool\tool.script.execute.py", line 23, in <module>
File "D:\...\UtilityDataManagementSupport_3_5).atbx\udms\esri.py", line 557, in wrapper
f = func(*args, **kwargs)
File "D:\...\UtilityDataManagementSupport_3_5).atbx\udms\logic\__init__.py", line 232, in batch_trace
return ts.main(
~~~~~~~^
where_clause=expression,
^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
history_field=history_field,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "D:\...\UtilityDataManagementSupport_3_5).atbx\udms\logic\un_trace.py", line 727, in main
layer = self.un.create_table(source_id=source_id)
File "D:\...\UtilityDataManagementSupport_3_5).atbx\udms\un_helper.py", line 954, in create_table
result = arcpy.MakeTableView_management(in_table=path, out_view=out_layer, where_clause=where_clause)[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 16735, in MakeTableView
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 16731, in MakeTableView
gp.MakeTableView_management(*gp_fixargs((in_table, out_view, where_clause, workspace, field_info), True))
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 533, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
~~~^^^^^^^^^^^^^^^^^^^^^^^^^
arcgisscripting.ExecuteError: ERROR 000358: Invalid expression
Failed to execute (MakeTableView).
Failed script Batch Trace...
Failed to execute (BatchTrace).