Skip to main content
added 47 characters in body
Source Link
Bera
  • 77.9k
  • 14
  • 78
  • 188

Try using AddFieldDelimiters and format to create the sql expression string:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure how your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure how your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)

Try using AddFieldDelimiters and format to create the sql expression string:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure how your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)
added 3 characters in body
Source Link
Bera
  • 77.9k
  • 14
  • 78
  • 188

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure whathow your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure what your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure how your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)
added 410 characters in body
Source Link
Bera
  • 77.9k
  • 14
  • 78
  • 188

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure what your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Try using AddFieldDelimiters:

SQL_stat = "{0} is equal to '{1}'".format(arcpy.AddFieldDelimiters(datasource=fc2, field="unique_id2"), row[0])

Not sure what your data looks like, but you should probably think about using a dictionary instead of nesting cursors. Something like:

datalookup = {k:v for k,v in arcpy.da.SearchCursor(fc1, ["unique_id1","Col1"])}

with arcpy.da.UpdateCursor(fc2, ["unique_id2", "Col2"]) as cursor:
    if row[0] in datalookup:
        row[1] = datalookup[row[0]]
        cursor.updateRow(row)
Source Link
Bera
  • 77.9k
  • 14
  • 78
  • 188
Loading