2

So, I'm still struggling with an ESRI 10.0 installation with an Oracle ArcSDE database. I'm nearing the end ....

In trying to programmatically edit the versioned data. It needs to be done in an editing session. The DA module was not introduced to 10.1 so is unavailable. We thought maybe we could do it through the Python window in the Desktop environment. I have been trying but I don't believe there is a way to tell the Python script, use the current settings of the Desktop. I've tried some different combinations to get the ListFeatureClasses() but it is always empty.

I don't think I am going to be able to create / update / delete objects in this configuration. Or am I missing something?

2
  • 1
    You possibly want ListLayers rather than ListFeatureClasses
    – Midavalo
    Jun 16 '16 at 20:15
  • 1
    ArcGIS 10.0 was retired from support at the start of 2016. You shouldn't be using it, because it's old, slow, and incompatible with modern supported databases (which have been patched for security vulnerabilities), but that doesn't mean it didn't work, back in its prime. I suggest you edit your question to contain the code you have written that doesn't work.
    – Vince
    Jun 16 '16 at 23:33
2

By the da module, I assume you mean the Data Access module and are using the search/update/insert cursor functions. If that is the case, there is another workflow that you can use for arcGIS 10.0 without the da functionality using set.Value.

############ To create new data : The example below is for a table in an fgdb.
import arcpy
from arcpy import InsertCursor
from arcpy import env

env.workspace = "C:\\Temp\\" # assuming all necessary files are in the current workspace
newTable = "newTable"  
# arcpy.CreateFeatureDataset_management(env.workspace, newShape) # for poly/point/line features
arcpy.CreateTable_management(env.workspace, newTable)
arcpy.AddField_management(newTable, "Field1", "DOUBLE", "", "", "", "", "NULLABLE")

def listcolumns(x): # use this function to list fields in your feature classes
    columnlist = arcpy.ListFields(x)
    for col in columnlist:
        print"\t%s" % col.name

rows = InsertCursor(newTable)
# Create 100 new rows and add data to them, in the case below I just added sequential id's.
for x in xrange(0, 99):
    row = rows.newRow()
    row.setValue("Field1", x)
    rows.insertRow(row)
############ Updating data : editing a feature class in an fgdb.in this case replacing the 5th digit of a row with another digit.
from arcpy import UpdateCursor
feat = "feature" # name of feature
column1 = "CityCode" # Field name that is found in "feature"
arcpy.AddField_management(feat, "edited_CityCode", "DOUBLE", "", "", "", "", "NULLABLE")
rows = UpdateCursor(feat)
for row in rows:
    if len(str(row.getValue(column1))) == 8:
        row.edited_CityCode = str(row.getValue(column1))[0:4] + str(0) + str(row.getValue(column1))[5:]
    rows.updateRow(row)
    else:
        print "Code not of length 8, 5th digit not replaced in the edited_CityCode column"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.