1

I would like to iterate over multiple tables in a geodatabase then feed the tables into the "Table to Domain" tool in ArcGIS ModelBuilder.

Currently it only seems to iterate over 1 table.

I have attached a graphic of the current setup as well as the python export.

# -*- coding: utf-8 -*-

# Generated by ArcGIS ModelBuilder on : 2021-07-14 11:43:19

import arcpy
def #  NOT  IMPLEMENTED# Function Body not implemented

def HeritageDomainLoad():  # HeritageDomainLoad

# To allow overwriting outputs change overwriteOutput option to True.
arcpy.env.overwriteOutput = False

HERITAGE_gdb = "P:\\01_GIS_Data\\TEST_CorporateDataStore_LOAD\\HERITAGE.gdb"

for domaintables, Name in #  NOT  IMPLEMENTED(HERITAGE_gdb, "TBL*", "", "NOT_RECURSIVE"):

    # Process: Table To Domain (16) (Table To Domain) 
    Updated_Input_Workspace = arcpy.TableToDomain_management(in_table=domaintables, code_field="Code", description_field="Desc_", in_workspace=HERITAGE_gdb, domain_name="Code", domain_description="Desc_", update_option="REPLACE")[0]

if __name__ == '__main__':
    # Global Environment settings
    with arcpy.EnvManager(scratchWorkspace=r"P:\02_GIS_Jobs\P001-P500\P0151\Projects\Default.gdb", workspace=r"P:\02_GIS_Jobs\P001-P500\P0151\Projects\Default.gdb"):
    HeritageDomainLoad()

enter image description here

1
  • The code export is not necessary when showing a model. Your model looks sound, which lead me to ask the simple question how many table names do you have that start with "TBL"? I'm guessing one...?
    – Hornbydd
    Commented Jul 14, 2021 at 9:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.