Add Global IDs (Data Management)

This ArcGIS 2.7 documentation has been archived and is no longer updated. Content and links may be outdated. See the latest documentation.

Summary

Adds global IDs to a list of geodatabase feature classes, tables, and feature datasets.

Usage

  • GlobalIDs uniquely identify a feature or table row in a geodatabase and across geodatabases.

  • If the input dataset is from an enterprise geodatabase, it must be from a database connection established as the data owner.

Syntax

arcpy.management.AddGlobalIDs(in_datasets)
ParameterExplanationData Type
in_datasets
[in_dataset,...]

A list of geodatabase classes, tables, and feature datasets to which global IDs will be added.

Layer; Table View; Dataset

Derived Output

NameExplanationData Type
out_datasets

The updated datasets.

Layer; Table View; Dataset

Code sample

AddGlobalIDs example 1 (Python window)

The following Python window script demonstrates how to use the AddGlobalIDs function in the Python window.

import arcpy
arcpy.env.workspace = "C:/data/MySDEdata.sde" 
arcpy.AddGlobalIDs_management("GDB1.Heather.Roads")
AddGlobalIDs example 2 (stand-alone script)

The following Python script demonstrates how to use the AddGlobalIDs function with an enterprise feature class.

# Name: AddGlobalIDs_Example2.py
# Description: Add globalIDs to a feature class. The feature class is in an enterprise workspace.

# Import system modules
import arcpy

# Set workspace
arcpy.env.workspace = "C:/Data/MySDEdata.sde"

# Set local variables
in_dataset = "GDB1.Heather.Roads"

# Execute AddGlobalIDs
arcpy.AddGlobalIDs_management(in_dataset)
AddGlobalIDs example 3 (stand-alone script)

The following Python script demonstrates how to use the AddGlobalIDs function with multiple enterprise feature classes.

# Name: AddGlobalIDs_Example2.py
# Description: Add globalIDs to a list of datasets. Both feature classes are in the same enterprise workspace.

# Import system modules
import arcpy

# Set workspace
arcpy.env.workspace = "C:/Data/MySDEdata.sde"

# Set local variables
in_dataset1 = "GDB1.Heather.Roads"
in_dataset2 = "GDB1.Heather.Streets"

# Execute AddGlobalIDs
arcpy.AddGlobalIDs_management([in_dataset1, in_dataset2])

Licensing information

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

Related topics