AnsweredAssumed Answered

Join multiple tables to multiple feature classes arcpy

Question asked by NatiNati1186 on Mar 31, 2020
Latest reply on Mar 31, 2020 by NatiNati1186

Hello,

I need help to create a script that would allow me to loop through multiple tables in a geodatabase and join them to the correct feature class in another geodatabase. There are in total 77 tables and 77 feature classes. I would tell GIS to join those where a portion of the table name matches a portion of the Feature class name. 

For example:

      Table Name 1: "NAL11F201901"

      Feature class 1: "T11"

 

       Table Name 2: "NAL12F201901

       Feature Class 2: "T12"

Important:

  • All of the tables and the feature classes have the same unique field name. 
  • I need to join all of the fields. 
  • The join needs to be permanent.

 

I am not sure if Add join is better to use or if I should use Join field.

I don't really know what to do next.

I would really appreciate any help with this. 

Thanks!

import arcpy

in_features = r"D:\APRX_MXDS\USA_Parcels_2019_Project\Florida_Parcels_Per_County_Final.gdb"
join_tables = r"D:\APRX_MXDS\USA_Parcels_2019_Project\Florida_Property_Data_Per_County.gdb"

list_infeatures = arcpy.ListFeatureClasses()
list_join_tables = arcpy.ListTables(*NAL)
UniqueField = "CO_PARCELID"

for fc in list_infeatures:
    arcpy.AddJoin_management()

Outcomes