AnsweredAssumed Answered

Transfering legacy data from MS Access into new (empty) Geodatabase

Question asked by roy_hewitt on Mar 29, 2012
Latest reply on Mar 29, 2012 by roy_hewitt
Hello all,

I'm working on transfering serveral tables from a MS Access database into a newly created (and empty) geodatabase.  The plan is to use this new database in an arcpad solution for our field staff.

I've written a script that uses cursors to find data in the MS Access database, store it as a variable, then insert it into a new row in the empty geodatabase.

Everything seems to run as planned until it reaches the Other_Methods variable -- it kicks back an error that it can't set that attribute.

The field settings:  string, domain(Yes or No), length: 3
The attribute value to be set: "No"

If you could take a look at the sample code, it will add context:

#Import modules, environment settings import arcpy arcpy.env.overwriteOutput = True  # Database connection variables geodatabase = 'P:/GIS_Development/ArcGIS Database Design/Landowner.gdb/Agreements' accessDatabase = 'Y:/Database/LANDOWNER/NewLandowner.mdb/TblAgreements'  #Create cursor for ACCESS Database and New Landowner GDB accessCursor = arcpy.SearchCursor(accessDatabase)  # Create a variable that stores the value for column in a given row in the access table for accessRow in accessCursor:     agreeID = accessRow.getValue("Agreement_ID")      # This section converts 1's and 0's to Yes and No for trapping techniques (/ tools) ie. conibear     conibear = accessRow.getValue('Allow_Conibear')     if conibear == 1:         conibear = 'Yes'     else:         conibear = 'No'      foothold = accessRow.getValue('Allow_Foothold')     if foothold == 1:         foothold = 'Yes'     else:         foothold = 'No'      snare = accessRow.getValue('Allow_Snare')     if snare == 1:         snare = 'Yes'     else:         snare = 'No'      otherMeth = accessRow.getValue('Other_Methods')     if otherMeth == 1:         otherMeth = 'Yes'     else:         otherMeth = 'No'      # END SECTION FOR TRAPPING TECHNIQUES      ######   Copy remaining fields to temporary variables #####     otherMethCom     = accessRow.getValue('Other_MethComments')     waterfowl        = accessRow.getValue('Access_Waterfowl')     waterfowlCom     = accessRow.getValue('Access_Waterfowl_Comments')     deer             = accessRow.getValue('Access_Deer')     deerCom          = accessRow.getValue('Access_Deer_Comments')     trap             = accessRow.getValue('Access_Trap')     trapCom          = accessRow.getValue('Access_Trap_Comments')     primeSpecies     = accessRow.getValue('Primary_Species')     otherSpecies     = accessRow.getValue('Other_Species_Allowed')     otherSlist       = accessRow.getValue('Other_Species_List')     agreeDate        = accessRow.getValue('Agrmnt_Date')     expires          = accessRow.getValue('Expires')     specialist       = accessRow.getValue('WS_Agent')     agreeStatus      = accessRow.getValue('Agrmnt_Status')     statusCom        = accessRow.getValue('Status_Comment')     callFirst        = accessRow.getValue('Call_First')     coopID           = accessRow.getValue('Coop_ID')     callCom          = accessRow.getValue('Call_Comments')      # "Paste" the stored value from the access table into the new geodatabase     gdbCursor = arcpy.InsertCursor(geodatabase)     row = gdbCursor.newRow()      #Fill out fields with variables that are storing MS Access data     row.Agreement_ID              = agreeID       row.Allow_Conibear            = conibear     row.Allow_Foothold            = foothold     row.Allow_Snare               = snare     row.Other_Methods             = otherMeth     row.Other_MethComments        = otherMethCom     row.Access_Waterfowl          = waterfowl     row.Access_Waterfowl_Comments = waterfowlCom     row.Access_Deer               = deer     row.Access_Deer_Comments      = deerCom     row.Access_Trap               = trap     row.Access_Trap_Comments      = trapCom     row.Primary_Species           = primeSpecies     row.Other_Species_Allowed     = otherSpecies     row.Agreement_Date            = otherSlist     row.Expires                   = expires     row.WS_Specialist             = specialist     row.Agreement_Status          = agreeStatus     row.Status_Comment            = statusCom     row.Call_First                = callFirst     row.Coop_ID                   = coopID     row.Call_Comments             = callCom     gdbCursor.insertRow(row)  

Any insight would be greatly appreciated!