Remove Join (Data Management)


Removes a join from a feature layer or table view.



RemoveJoin_management (in_layer_or_view, {join_name})
ParameterExplanationData Type

The layer or table view from which the join will be removed.

Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View

The join to be removed.


Code Sample

Remove Join Example (Python Window)

The following Python window script demonstrates how to use the RemoveJoin tool in immediate mode in ArcMap on a feature layer in the TOC named veglayer.

arcpy.RemoveJoin_management("veglayer", "vegtable")
Remove Join Example 2 (Stand-alone Script)

This stand-alone script shows the RemoveJoin function as part of a workflow to add a field to a table and calculate its values based on the values in a field from a joined table.

# Description: Adds a field to a table, and calculates its values based
#              on the values in a field from a joined table

# Import system modules
import arcpy
from arcpy import env

    # set the environments
    env.workspace = "C:/data"
    env.qualifiedFieldNames = "UNQUALIFIED"
    # Define script parameters    
    inFeatures = "Habitat_Analysis.gdb/vegtype"
    layerName = "veg_layer"
    newField = "description"
    joinTable = "vegtable.dbf"
    joinField = "HOLLAND95"
    calcExpression = "!vegtable.VEG_TYPE!"
    outFeature = "Habitat_Analysis.gdb/vegjoin335"
    # Add the new field
    arcpy.AddField_management (inFeatures, newField, "TEXT")
    # Create a feature layer from the vegtype featureclass
    arcpy.MakeFeatureLayer_management (inFeatures,  layerName)
    # Join the feature layer to a table
    arcpy.AddJoin_management (layerName, joinField, joinTable, joinField)
    # Populate the newly created field with values from the joined table
    arcpy.CalculateField_management (layerName, newField, calcExpression, "PYTHON")
    # Remove the join
    arcpy.RemoveJoin_management (layerName, "vegtable")
    # Copy the layer to a new permanent feature class
    arcpy.CopyFeatures_management (layerName, outFeature)
except Exception, e:
    import traceback, sys
    tb = sys.exc_info()[2]
    print "Line %i" % tb.tb_lineno
    print e.message


This tool does not use any geoprocessing environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes