Select to view content in your preferred language

Modify existing Geodatabase Sequences

6204
14
05-05-2020 12:25 PM
Status: Open
Labels (1)
JoeBorgione
MVP Emeritus

There are two geoprocessing tools in the Geodatabase Admin tool box: Create and Delete Database Sequence.  You can get access to a sequence's properties using arcpy.ListDatabaseSquences.

 

The database sequence help page states: DatabaseSequence objects cannot be initialized directly and the properties table shows all the properties as read only.

 

I guess the only way to alter an existing database sequence is to delete it and recreate it.  It would be cool if an existing one could be altered or modified.

14 Comments
SSWoodward
Status changed to: Open
 
MatthewStull1

I keep getting the error message "Could not open SDE workspace." when I run this code:

import arcpy
arcpy.env.workspace = r"R:\GIS_Ongoing\Cityworks\Cityworks GIS Editing Environment\Cityworks Catalog ONLY\Cityworks Development matts.sde"
seqwork = r"R:\GIS_Ongoing\Cityworks\Cityworks GIS Editing Environment\Cityworks Catalog ONLY\Cityworks Development matts.sde"
sq_list = arcpy.da.ListDatabaseSequences(seqwork)
#attribue rule sequences
for seq in sq_list:
      arcpy.management.DeleteDatabaseSequence(seq)

I haven't done python scripting for a while so I'm just trying to make this work.  I'm using Pro 3.1

SSWoodward

Hard to say. 

Check to make sure you have the correct access: Delete Database Sequence Doc

Does ListDatabaseSequences() work on its own for you?

KevinVaughn

@SSWoodward - If you're still looking for workflow examples, here is one I am in the middle of:

As a Solution Architect I need to be able to reset a sequence when my users are ready to switch from training and testing to 'live' work.

In our situation we do not have a dev instance of enterprise where users can test out new solutions.  So quite often they are 'testing' in our live environment and then when they decide they are ready to start actually using the solution they want things reset.  Admittedly, this is us catering to their need to have things like file numbers start at an 'clean' value like 10,000.  From a data perspective it doesn't matter but users often care about things like that.

It would be very handy to have a tool that let us specify a new "last number used" value for the sequence.  I can also see instances where this would be helpful for making landmarks in a sequence.  For example, all numbers above 20,000 are after we [started doing something new].