tedrick / SyncSurvey

Synchronize a Hosted Feature Service to an Enterprise Geodatabase
18 stars 4 forks source link

getSurveyTables errors when tables don't exist #3

Open jgustine opened 7 years ago

jgustine commented 7 years ago

Hi james,

Just working my way thru your great script and stuck on getSurveyTables. This is a 1st run of the tool, so there are no feature classes or tables to get. The listFeatureClasses and ListTables functions return 'None'. So the allTables.extend fails on the None Type.

featureClasses = arcpy.ListFeatureClasses(wildcard)
print featureClasses
tables = arcpy.ListTables(wildcard)
print tables

#Loop through the tables, checking for:
#1) Is this an attachment table?
#2) Does the prefix actually match the prefix term exactly?

allTables = featureClasses

allTables.extend(tables)

Will this script create the feature classes and tables if they don't exist?

jgustine commented 7 years ago

Checking for empty table lists fixed the issue on 1st run...

featureClasses = arcpy.ListFeatureClasses(wildcard)
print featureClasses
if featureClasses == None:
    featureClasses = []
tables = arcpy.ListTables(wildcard)
print tables
if tables == None:
    tables = []