I have several scripts that are run against a geodatabase, each script creates a sde file with the credentials, then proceeds to read a value from a table using a search cursor
database = gp.create_connectionfile(log, base_dir, user_do, instance_sde, "DATABASE_AUTH",
username=user_do, password=password_do, save_user_pass="SAVE_USERNAME",
database=database_name)
arcpy.env.workspace = database
# Retrieve and strip current version
source_version = None
with arcpy.da.SearchCursor("{0}.RAC_ADD_IN".format(user_do), "VERSION") as cursor:
for row in cursor:
if row[0]:
source_version = StrictVersion(row[0].rsplit(".", 1)[0])
break
When the set of scripts run, sometimes all scripts run without issue, sometimes one script fails, the issue is that the failing script is not always the same. the error presented is:
ERROR cannot open 'DataOwner.RAC_ADD_IN'
ERROR ['Traceback (most recent call last):\n', ' File "C:\\01_Script.py", line 134, in <module>\n main(argv[1:])\n', ' File "C:\\01_Script.py", line 86, in main\n with arcpy.da.SearchCursor("{0}.RAC_ADD_IN".format(user_do), "VERSION") as cursor:\n', "RuntimeError: cannot open 'DataOwner.RAC_ADD_IN'\n"]
Facts:
- The credential are always the same
- The table is always the same
- In the script above, the line 1 is just a wrapper to the arcpy function to create a sde connection file.
- This behavior has been appearing since ArcGIS Pro 2.8, currently this is running in 2.9.1
How this can be managed?