Import Associations (Utility Network)

Summary

Imports associations from a comma-separated values file (.csv) into an existing utility network. This tool can be used in conjunction with the Export Associations tool.

Learn more about how to import associations

Usage

  • Associations must be in a single .csv file.

  • Features listed in the .csv file must exist in the utility network.

  • Features listed in the .csv file must have supporting rules.

  • If an error occurs during import—for example, a missing rule—the entire import process will be rolled back. Review the errors and inspect the .csv file before importing the associations again.

  • When working with an enterprise geodatabase, the Input Utility Network must be from a database connection established as the database utility network owner.

  • The information in the .csv file is stored in the following format: ASSOCIATIONTYPE, FROMFEATURECLASS, FROMASSETGROUP, FROMASSETTYPE, FROMGLOBALID, FROMTERMINAL, TOFEATURECLASS, TOASSETGROUP, TOASSETTYPE, TOGLOBALID, TOTERMINAL, ISCONTENTVISIBLE, PERCENTALONG.

    .csv columns

    ColumnDescriptionExample

    ASSOCIATIONTYPE

    The type of association.

    • Junction Junction Connectivity
    • Junction Edge From Connectivity
    • Junction Edge Midspan Connectivity
    • Junction Edge To Connectivity
    • Containment
    • Structural Attachment

    Containment

    FROMFEATURECLASS/TOFEATURECLASS

    The feature class or object participating in the association.

    ElectricDistributionDevice, ElectricDistributionAssembly, StructureJunction

    FROMASSETGROUP/TOASSETGROUP

    The asset group of the feature.

    Transformer, Fuse, Elbow

    FROMASSETTYPE/TOASSETTYPE

    The asset type of the feature.

    Streetlight, Attachment, Single-phase padmounted

    FROMGLOBALID/TOGLOBALID

    The global ID of the feature.

    {16558C73-013C-4169-A095-7E9DCD57EB57}

    FROMTERMINAL/TOTERMINAL

    The terminal participating in the association. This is only applicable to junction-junction connectivity associations.

    Single Terminal, Load, Source

    ISCONTENTVISIBLE

    A Boolean flag indicating whether the content is visible. This is only applicable to containment associations.

    False, True

    PERCENTALONG

    The percent along value for junction-edge midspan connectivity associations between a junction object and an edge object.

    0.75

Parameters

LabelExplanationData Type
Input Utility Network

The utility network to which the associations will be imported.

Utility Network; Utility Network Layer
Association Type

Specifies the type of association that will be imported.

  • AllAll association types will be imported.
  • Junction-junction connectivityThe junction-junction connectivity association type will be imported.
  • ContainmentThe containment association type will be imported.
  • AttachmentThe structural attachment association type will be imported.
  • Junction-edge connectivity (from side of edge)The junction-edge connectivity (from side of edge) association type will be imported.
  • Junction-edge connectivity (midspan)The junction-edge connectivity (midspan) association type will be imported.
  • Junction-edge connectivity (to side of edge)The junction-edge connectivity (to side of edge) association type will be imported.
String
Input File

The .csv file from which the associations will be imported.

File

Derived Output

LabelExplanationData Type
Updated Utility Network

The updated utility network.

Utility Network

arcpy.un.ImportAssociations(in_utility_network, association_type, csv_file)
NameExplanationData Type
in_utility_network

The utility network to which the associations will be imported.

Utility Network; Utility Network Layer
association_type

Specifies the type of association that will be imported.

  • ALLAll association types will be imported.
  • JUNCTION_JUNCTION_CONNECTIVITYThe junction-junction connectivity association type will be imported.
  • CONTAINMENTThe containment association type will be imported.
  • STRUCTURAL_ATTACHMENTThe structural attachment association type will be imported.
  • JUNCTION_EDGE_FROM_CONNECTIVITYThe junction-edge connectivity (from side of edge) association type will be imported.
  • JUNCTION_EDGE_MIDSPAN_CONNECTIVITYThe junction-edge connectivity (midspan) association type will be imported.
  • JUNCTION_EDGE_TO_CONNECTIVITYThe junction-edge connectivity (to side of edge) association type will be imported.
String
csv_file

The .csv file from which the associations will be imported.

File

Derived Output

NameExplanationData Type
out_utility_network

The updated utility network.

Utility Network

Code sample

ImportAssociations example (Python window)

This sample script imports all types of associations into a utility network called GridNetwork.

import arcpy
arcpy.ImportAssociations_un("GridNetwork", "ALL", "C:\\Temp\\AllAssociations.csv")
ImportAssociations example 2 (Python window)

This sample script imports junction-junction connectivity associations into a utility network called GridNetwork.

import arcpy
arcpy.ImportAssociations_un("GridNetwork", "JUNCTION_JUNCTION_CONNECTIVITY", 
                            "C:\\Temp\\JJconnectivity.csv")
ImportAssociations example 3 (Python window)

This sample script imports containment associations into a utility network called GridNetwork.

import arcpy
arcpy.ImportAssociations_un("GridNetwork", "CONTAINMENT", 
                            "C:\\Temp\\Containment.csv")
ImportAssociations example 4 (Python window)

This sample script imports structural attachment associations into a utility network called GridNetwork.

import arcpy
arcpy.ImportAssociations_un("GridNetwork", "STRUCTURAL_ATTACHMENT", 
                            "C:\\Temp\\StructuralAttachment.csv")

Environments

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics