I decided to completely restructure the code I was using for my ingest/QAQC script that I am building. I managed to get around using a table join for the first QA/QC part, but this part may require the join. Here's my code block.
def findRevisit(): #Looks for revisited in the incoming data set using table join and DT(date) field. Flags potential revisits with '2' in QAQC_FLAG field.
arcpy.env.workspace = inPGDB
rtTbl = "midFCviewJoin_vw"
leftTbl = in_table_view
joinField = "UUID"
dateField = "DT"
updField = "QAQC_FLAG"
fields = [joinField,dateField,updField]
leftDate = in_table + "." + dateField
rtDate = midFCview+ "." + dateField
arcpy.AddJoin_management(leftTbl,joinField,rtTbl,joinField)
## arcpy.JoinField_management(leftTbl,joinField,rtTbl,joinField,"")
sql = leftTbl + "." + joinField + " <> " + rtTbl + "." + joinField
print "SQL where clause: " + sql
with arcpy.da.UpdateCursor(leftTbl,[dateField,updField],sql) as cursor:
for rec in cursor:
rec[1]=2 ##Set QAQC flag = 2 for possible revisits in the incoming dataset
cursor.updateRow(rec)
print rec
## arcpy.DeleteField_management(in_table, "QAQC_FLAG_1")
arcpy.RemoveJoin_management(leftTbl)
return leftTbl,rtTbl,sql
del cursor,rec
Seems like it should run. Both table views are in the same workspace. It still falls on its face. Here is the error I get from the cursor:
Traceback (most recent call last):
File "C:/Users/kgaines/Documents/Aquadat/Scripting/AquaDat_tableCreate_findDup_findRevisit_defFunct.py", line 232, in <module>
main()
File "C:/Users/kgaines/Documents/Aquadat/Scripting/AquaDat_tableCreate_findDup_findRevisit_defFunct.py", line 225, in main
findRevisit()
File "C:/Users/kgaines/Documents/Aquadat/Scripting/AquaDat_tableCreate_findDup_findRevisit_defFunct.py", line 169, in findRevisit
for rec in cursor:
RuntimeError: Too few parameters. Expected 2.
Where is the "Too few parameters" error coming from?
Here are a couple of images showing the field names in the in_table. All of the other tables and views have exactly the same fields.