Batch creating Database Sequences Using Python

270
2
02-26-2024 11:54 AM
Labels (2)
gcromley
New Contributor

Greetings,  I'm new to the automation side of things in GIS.  I'm trying to use python to automate the creation of Database Sequences in an EGDB.  I get the following error:  

ExecuteError: ERROR 001056: The input is not a valid Geodatabase.

However, the database connection file is valid.  My code is below.  

 

import arcpy
import csv

arcpy.env.workspace = r"C:/Users/gcromley/Documents/ArcGIS/Projects/EnterpriseGIS/Development.sde"

csv_file = r"C:\Users\gcromley\Desktop\Book1.csv"

sequence_names = []

with open(csv_file, 'r') as file:
    reader = csv.reader(file)
    for row in reader:
        sequence_names.extend(row)
        
for seq_name in sequence_names:
    
    arcpy.management.CreateDatabaseSequence(r"C:/Users/gcromley/Documents/ArcGIS/Projects/EnterpriseGIS/Development.sde", seq_name,1,1)

 

 

2 Replies
elpsottile
New Contributor

Are you trying to create the next sequence value when you create a feature?

Have you tried this:

https://community.esri.com/t5/attribute-rules-videos/generating-unique-ids-with-attribute-rules/m-p/...

0 Kudos
AlexanderDanielPratama
Esri Contributor

Based on Esri Documentation 001056: The input is not a valid Geodatabase.—ArcGIS Pro | Documentation, you need to upgrade the database. However, could you recheck the geodatabase connection properties that you have already checklist the checkbox of saving username-password.

Hope it helps you,

Cheers

0 Kudos