Skip To Content

Import Associations

Summary

Imports connectivity, containment, and structural attachment associations from a comma-separated values (.csv) file into an existing utility network.

Associations must be imported from a single .csv file.

Usage

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

    .csv columns

    ColumnDescriptionExample

    ASSOCIATIONTYPE

    The type of association.

    JUNCTION_JUNCTION_CONNECTIVITY, CONTAINMENT, STRUCTURAL_ATTACHMENT

    FROMFEATURECLASS/TOFEATURECLASS

    The feature class participating in the association.

    ElectricDistributionDevice, ElectricDistributionAssembly, StructureDevice

    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 associations.

    Single Terminal, Load, Source

    ISCONTENTVISIBLE

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

    False, True

  • Associations must be in a comma-separated values (.csv) file.

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

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

  • This tool can be used in conjunction with the Export Associations tool.

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

  • The connected ArcGIS Enterprise portal account must be the portal utility network owner.

  • The input utility network must be from a database connection established as the database utility network owner.

Syntax

ImportAssociations(in_utility_network, association_type, csv_file)
ParameterExplanationData Type
in_utility_network

The utility network receiving the associations.

Utility Network; Utility Network Layer
association_type

The type of associations to import.

  • ALLOne or more types of association
  • JUNCTION_JUNCTION_CONNECTIVITYJunction-junction connectivity association type
  • CONTAINMENTContainment association type
  • STRUCTURAL_ATTACHMENTStructural attachment association type
String
csv_file

The .csv file containing the associations to import.

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

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics