Select to view content in your preferred language

Joining Data; NOT Using the Join Field Tool

6162
4
Jump to solution
02-22-2012 10:37 AM
BrittanyGale
Frequent Contributor
Hello,

I am trying to write a script that joins a monthly parcel ownership data table to a parcel feature class. Throughout this process I figured out the difference between Joining and the Join Field geoprocessing tool...

- Joining is limited to the map document itself
- The Join Field tool permanantly appends the new table to the feature class.

I cannot find a script snippet that allows me to join a table only within the map document.

Anyone know of any solutions? Thank you!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
MVP Honored Contributor
I might be missing the point, but Add Join?

View solution in original post

4 Replies
DarrenWiens2
MVP Honored Contributor
I might be missing the point, but Add Join?
BrittanyGale
Frequent Contributor
Dear me. I can't beleive I didn't figure that out. My searches weren't coming up with this for some reason. I typed "python, arcpy, join" into Google and Esri Support and only found results including the JoinField tool.

Thank you so much! I really appreciate it! 🙂
0 Kudos
KimOllivier
Honored Contributor
I realise that you just wanted to do a temporary join in a script, but then what are you doing with the join? It is very slow.
Be wary of the JoinField tool, it does not scale for large datasets. It can take several hours on a large table. :mad:

So what else can a poor Dilbert do?

Dictionary/UpdateCursor

My first attempt was to read the data with a searchCursor into a dictionary, then write out using an updateCursor.
Better, but a bit complicated and still very slow at 10.0, improved at 10.1.

FieldMap with a copy

I have recently discovered that you can do a temporary join and then use TableToTable or FeatureclassToFeatureclass with a Fieldmap.
This is really fast in comparison, but it is even harder than 'cursor and dictionary' to set up a fieldmap in a script.:(
My workaround is to run the command interactively, turn off unwanted fields, and then grab the Python snippet from the results window and paste it into a script.
It is then a 'macro' that you can substitute the paths and names with variables. Use triple quotes to imbed quotes more easily.

The disadvantage with the fieldmap method is that you get yet another copy, but that is normal for geoprocessing tools. you just have to delete and rename to cleanup.
AmySmith3
Deactivated User
Be wary of the JoinField tool, it does not scale for large datasets.


I'm wondering, why is it that the Join Field tool is so slow?

-Amy
0 Kudos