Title Export Reporting Data
Exports tables with domain descriptions to an output geodatabase.
- For optimal read performance, a database connection is recommended.
- For optimal write performance, a mobile geodatabase (sqlite) is recommended for the Output Geodatabase.
- File geodatabases only support a subset of views.
- If you specify the utility network controller dataset, association and controller views will only be created to the input datasets if the target dataset name matches the class name in the source utility network.
- You can target the same target dataset with multiple Input Datasets. This allows you to specify the layers with definition queries or subtype group layers for the Input Datasets and load their records to a single target dataset.
- If the length of the view name exceeds the table name limit, the subtype description will be replaced with its code.
- When exporting query layers (e.g., the archive class), domain descriptions will only be populated if the Target Dataset Name matches the source data table name.
License
Basic
ExportReportingData (output_gdb, {datasets}, {output_options}, {controller_dataset}, {field_override})
Parameter | Explanation | Data Type |
---|---|---|
output_gdb |
Dialog Reference
The output geodatabase where the records will be exported. |
DEWorkspace |
datasets (Optional) |
Dialog Reference
The datasets to export.
|
GPValueTable |
output_options (Optional) |
Dialog Reference
Various options that control how the output is created. Create Database Views is only available with an ArcGIS Pro Standard or Advanced license.
|
GPString |
controller_dataset (Optional) |
Dialog Reference
The Utility Network. When specified, additional options will be available. |
GPUtilityNetworkLayer |
field_override (Optional) |
Dialog Reference
A table defining field names and visibility for the subtype views. This parameter is only applicable when "Create Database Views" is checked. The Map Layers to CSV tool in the Map toolset can be used to generate a table in this format from a map. It has the following schema:
|
GPTableView |
ExportReportingData example 1 (stand-alone script)
Exports all the classes from a Utility Network in parallel.
import datetime
import multiprocessing
import os
import arcpy
utility_network = "D:/data/un.sde/UtilityNetwork/Network"
reporting = "D:/data/reporting.sde"
include_geometry = False
schema_options = [
"CREATE_VIEWS",
]
data_options = [
"LOAD_RECORDS",
"TRUNCATE_TABLES",
]
un_options = [
"UN_ASSOCIATIONS",
"UN_CONTROLLERS",
]
def gather_sources():
"""All the UN sources"""
for network in arcpy.Describe(utility_network).domainNetworks:
for source in network.junctionSources + network.edgeSources:
if source.utilityNetworkFeatureClassUsageType == "SubnetLine":
continue
yield source.name.split(".")[-1]
def export(**kwargs):
arcpy.udms.ExportReportingData(
output_gdb=reporting,
**kwargs,
)
def export_wrapper(arg):
return export(**arg[0])
if __name__ == "__main__":
# (path, output name, geometry)
gdb = os.path.dirname(os.path.dirname(utility_network))
paths = [(os.path.join(gdb, s), s, include_geometry) for s in gather_sources()]
# Create the necessary schema/views in a first pass. This is suggested when running in parallel.
# If the schema is already defined, this step can be skipped.
export(datasets=paths, controller_dataset=utility_network, options=schema_options + un_options)
# Start Associations/Controllers first since this typically is one of the larger tables.
work = [[dict(controller_dataset=utility_network, output_options=data_options + un_options)]]
for path in paths:
work.append([dict(datasets=[path], output_options=data_options)])
# Spawn 4 subprocesses to divide the work.
print("Starting", datetime.datetime.now())
with multiprocessing.Pool(processes=4, maxtasksperchild=1) as pool:
pool.map(export_wrapper, work, chunksize=1)
print("Done", datetime.datetime.now())