Hello,
I am trying to use the ListDatabaseSequences function and when using a SDE connection, I always get following error: OSError: Could not open SDE workspace. If I use a FGDB connection it's working fine.
If I use the same SDE connection with the ListDomains function everything works just fine.
I am testing the code "as is" from the AGS Pro on-line documentation.
I am using AGS Pro 3.1.3
import arcpy
#this works for ListDatabaseSequences
#gdbFGDB = r"D:\droberge\temp\coa_GIS\dr_testArcade.gdb"
#this works for ListDomains
gdbSDE = r"D:\droberge\programs\GIS_PRO\dr_coa_MASTER\coaUNWater_coa_gis.sde"
sequences = arcpy.da.ListDatabaseSequences(gdbSDE)
domains = arcpy.da.ListDomains(gdbSDE)
try:
for seq in sequences:
print("------------------------")
print('Sequence name: {}'.format(seq.name))
print('Sequence start value: {}'.format(seq.startValue))
print('Sequence increment value: {}'.format(seq.incrementValue))
print('Sequence current value: {}'.format(seq.currentValue))
## for domain in domains:
## print(f"Domain name: {domain.name}")
## if domain.domainType == "CodedValue":
## coded_values = domain.codedValues
## for val, desc in coded_values.items():
## print(f"{val} : {desc}")
## elif domain.domainType == "Range":
## print(f"Min: {domain.range[0]}")
## print(f"Max: {domain.range[1]}")
except:
print(" we are in the except section... no bueno")
arcpy.AddMessage(arcpy.GetMessages(2))
print(arcpy.GetMessages(2))
print("Process is over!")
This is the error
sequences = arcpy.da.ListDatabaseSequences(gdbSDE)
OSError: Could not open SDE workspace.
Any help would be much appreciated.
Thanks!
Solved! Go to Solution.
for SQL server you can use SQL Management Studio or SQL to find sequences as noted here.
R_
Hello @DominicRoberge2 , this documentation does state that ListDatabaseSequences is "only supported for file geodatabases."
https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/listdatabasesequences.htm
There is an Enhancement already logged, ref ENH-000141842, "Add the ability to view or export database sequences from an enterprise database in streamlined fashion from ArcGIS Pro", which should address what you want to do.
for SQL server you can use SQL Management Studio or SQL to find sequences as noted here.
R_