Insert related records

395
2
03-03-2022 07:51 PM
JohnConnor01
New Contributor II

Hello,

Would someone be able to give me any insight how I go about importing a csv of inspection records for feature class using Python and Arcpy? I think I can get to the point of inserting the records, but I don't understand how I can match an inspection record with the related parent table? 

Thank you.

-JC from Boston

0 Kudos
2 Replies
by Anonymous User
Not applicable

You can do this several ways. Easiest may be using the Join field method documented here  

You will need to convert the csv to a database table format method documented here

You will need to find the shared field (primary key in the shapefile/ foreign key in the csv) that you can use to join the two datasets together.

If you can't convert the csv to a database table, you can use cursors or pandas to do the join and then export the joined shapefile. Depending on which way you want to go, (providing sample data could help) we can probably provide some code for it.

JohnConnor01
New Contributor II

Thank you JeffK! I will run with this for now and see where it takes me. Ill post back if needed! Thanks again.

-JC from Boston

0 Kudos