[GIS] How to copy data from one table to another using cursors

arcgis-desktoparcpycopycursor

I'm going to be as descriptive as possible.
I have a table (TA) with values which are null for some rows, filled out for others.
I have a table (TB) with the null values filled out.

Dec in TA is the shared value in TB (called Nulled in that table)

I can't do a table join because this would duplicate the amount of nulled columns in the first table.
The gist of what I want it to do is this: if CURR_TYPE (one of the columns) is null in TA, lookup its Dec value, go to TB, look for the same value under Nulled, copy TB's CURR_TYPE, and paste it onto TA's CURR_TYPE.

This is what I have so far, and I've tried variations on things I've found here, but I get lost with how to tell python to LOOKUP in another field, copy and

# Import arcpy module
import arcpy


# Local variables:
TA = "F:...\\TA"
TB = "F:...\\TB"
TLDisNull = arcpy.AddFieldDelimiters(TA, "SponsorOrganization") + " IS NULL"

#Update rows
with arcpy.da.UpdateCursor(TA, "CURR_TYPE", TLDisNull) as u_cursor:
        with arcpy.da.SearchCursor(TA, "Dec") as s_cursor1:
                for s_row in s_cursor1:
                        with arcpy.da.SearchCursor(TB, "Nulled") as s_cursor2:
                                for s_row in s_cursor2

Best Answer

I think a Join would actually serve you best. Instead of using a search cursor, join the two tables together with a common field (say ID) and use the field calculator with an if statement. So in TA (the one you want to update and check for NULL values) select the field you want to update ( CURR_TYPE).

Then in the field you want to update use Field Calculator:

if [CURR_TYPE] IS NULL then
  result = [CURR_TYPETB]
#If CURR_TYPE in TA is NULL then the field = CURR_TYPE IN TB
else
  result = [CURR_TYPE]
end if

After this is completed, remove the join