Skip to content

Instantly share code, notes, and snippets.

@amarinelli
Created October 6, 2014 15:25
Show Gist options
  • Save amarinelli/c1941399cd6439cb5257 to your computer and use it in GitHub Desktop.
Save amarinelli/c1941399cd6439cb5257 to your computer and use it in GitHub Desktop.
Export BLOB feature class attachments to folder
from arcpy import da
import os
inTable = r'Database Connections\CUTSP62__sde@GISDB.sde\GISDB.SDE.Canada__ATTACH'
fileLocation = r"C:\Users\AMarinelli\Downloads\blob"
with da.SearchCursor(inTable,['DATA','ATT_NAME']) as cursor:
for row in cursor:
binaryRep = row[0]
fileName = row[1]
# save to disk
open(fileLocation + os.sep + fileName, 'wb').write(binaryRep.tobytes())
del row
del binaryRep
del filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment