Skip to content

Commit

Permalink
Validate Database tool has all new functions as of 1/15/21 of the Arc…
Browse files Browse the repository at this point in the history
…Map version and runs with no errors
  • Loading branch information
ethoms-usgs committed Jan 28, 2021
1 parent e0ea009 commit 4327849
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
Binary file modified GeMS_Tools_AGP2.tbx
Binary file not shown.
16 changes: 12 additions & 4 deletions Scripts/GeMS_ValidateDatabase_AGP2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
# Edited 7/15/20 to work in ArcGIS Pro 2.5 with Python 3
# Evan Thoms
# 10/8/20 updates from Ralph's version '7 October 2020'
# 1/27/21 added all of the following updates from the ArcMap version - ET
#
# 22 December 2020: Edited output text to correctly identify XXX_Validation.gdb. Added option to delete unused rows in Glossary and DataSources - RH
# 23 December 2020: Refreshing GeoMaterialDict now also refreshes the domain associated with GeoMaterial field in DescriptionOfMapUnits - RH
# 28 December 2020: Added warning if active edit session on input GDB - RH
# 15 January 2021: Added warning if SRF not in (NAD83, WGS84)
# Added reminder to document any schema extensions
# Added feature dataset SRF names to database inventory - RH

import arcpy, os, os.path, sys, time, glob
from arcpy import metadata as md
from GeMS_utilityFunctions import *
from GeMS_Definition import *

versionString = 'GeMS_ValidateDatabase_AGP2.py, version of 8 October 2020'
versionString = 'GeMS_ValidateDatabase_AGP2.py, version of 27 January 2021'


metadataSuffix = '-vFgdcMetadata.txt'
Expand Down Expand Up @@ -856,9 +864,9 @@ def deleteExtraRows(table,field,vals):
# write starting messages
addMsgAndPrint(versionString)

# having trouble getting this to work in Python 3, punting for now, 1/27/21
# if editSessionActive(inGdb):
# arcpy.AddWarning ("\nDatabase is being edited. Results may be incorrect if there are unsaved edits\n")
if editSessionActive(inGdb):
arcpy.AddWarning ("\nDatabase is being edited. Results may be incorrect if there are unsaved edits\n")

if refreshGeoMaterialDict == 'true':
addMsgAndPrint('Refreshing GeoMaterialDict')
gmd = inGdb+'/GeoMaterialDict'
Expand Down
15 changes: 7 additions & 8 deletions Scripts/GeMS_utilityFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,12 @@ def editSessionActive(gdb):
row = next(rows)
with arcpy.da.UpdateCursor(tbl, fld) as rows2:
row2 = next(rows2)
except: # RuntimeError as e:
arcpy.AddMessage("workspace already in transaction mode")
#if e == "workspace already in transaction mode":
# this error means that no edit session is active
edit_session = False
# else:
# # we have some other error going on, report it
# raise
except RuntimeError as e:
if "workspace already in transaction mode" in str(e):
# # this error means that no edit session is active
edit_session = False
else:
# # # we have some other error going on, report it
raise
return edit_session

0 comments on commit 4327849

Please sign in to comment.