Select to view content in your preferred language

Modify existing Geodatabase Sequences

3779
13
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.

13 Comments
MarceloMarques

You can make changes to the sequence and increase for example the cache sequence values in the RDMBS using SQL.

JoeBorgione

Not in a file gdb...  

MarceloMarques

Yes, in a file gdb you have no option, you have to use the ArcCatalog tools.

JordanFollett1

Where do the sequences exist in the SQL DB?

SSWoodward
Status changed to: Needs Clarification

Thanks for the idea @JoeBorgione 

We're interested in knowing more about this.  Could you share some example workflows you use that would benefit from being able to alter the database sequence?

JoeBorgione

@SSWoodward I retired back in December 2022 and haven’t even thought about database sequences since then. I have landed a lot of fish however in that time…

All seriousness aside, let’s say you get a large influx of data you need to append into your database and with it comes a need to alter the sequence in some fashion. In my (former) case, that could come as an annexation into a city  

In a SQL Server database you can back door that but not in the case of the FGDB. 

If you need me, I’ll be on the river…

TitusGian

I wonder if there are any updates on this front.

Also, would it be possible to utilize a sequence from another EGDB? 

@SSWoodward @MarceloMarques @JoeBorgione 

MarceloMarques

@TitusGian - Geodatabase sequences are unique per featureclass and table, so it cannot be used for anything else, and avoid editing or modifing the sequence manually directly in the rdbms, this can cause issues if you do not know what you are doing is correct, you might end up with issues with objectid's.

MatthewStull1

Does anyone know of a way to delete all the sequences in an enterprise geodatabase at once?  I am having to refresh all of the data in a geodatabase without recreating it but I can't do that without deleting all the sequences (and attribute rules).  Is there a python script that could iterate through them and delete them?

SSWoodward

Afternoon @MatthewStull1 ,

Have you tried something like:

workspace = <workspace path>

for seq in arcpy.da.ListDatabaseSequences(workspace):
    arcpy.management.DeleteDatabaseSequence(workspace, seq.name)