I have created two geodatabases: Source GDB and Target GDB. Databases are basically copies of one another. Source GDB featureclasses are exported Directly from CAD whereas Target GDB contains feature classes that must be updated daily with new records from Source feature classes using search and insert cursor.
I was able to do this with a single-source feature class to a single target feature class and now I am trying to figure out how to update the entire list of target feature classes by using search and insert cursor.
In the code below I am trying to loop through both the Source and Target GDB, and if the source and target GDB are equal then create a search cursor for both source and target featureclass and insert a record if they do not exist in target featureclass. I get no error messages but my target featureclasses are not updated.
Any suggestions on what and where I am missing would be of great help.
Solved! Go to Solution.
I am answering to myself and posting the code that worked for me so that it might help someone with a similar issue. I replaced ListFeatureClass by Walk function and made some other slight changes and it worked by inserting all new records from the source feature classes to the target feature classes. Feature classes in both GDBs have the same name.
In cases like this where you have conditional statements and no errors, it is good to add some additional debugging print statements to make sure your conditional statements are evaluating to True. Given your cursor insertion is nested within two conditional statements, if either evaluates to False all the time, nothing will happen.
Thanks for your suggestion, I will look into it in detail with the debugging option.
I am answering to myself and posting the code that worked for me so that it might help someone with a similar issue. I replaced ListFeatureClass by Walk function and made some other slight changes and it worked by inserting all new records from the source feature classes to the target feature classes. Feature classes in both GDBs have the same name.