1

I am using Arcpy to load a table from Excel. One of the fields has a lot of text (up to 2000 characters) and when using arcpy.MakeTableView_management the field is given the type 'BLOB'. Is there any way to either prevent this from happening, i.e. making sure the field type is 'Text', or is there a way of reading the text in python so the data can be used?

I have read BLOB TYPE in Arcmap but it does not answer the question. I am specifically trying to read the data in Python, while the previous question referred to reading it in ArcMap.

asked Oct 13, 2016 at 10:51
11
  • 1
    How is this not a duplicste of the referenced question? Commented Oct 13, 2016 at 11:08
  • I am specifically trying to read the data in Python, while the previous question referred to reading it in ArcMap Commented Oct 13, 2016 at 11:11
  • 2
    If it were an option, it would have been documented; therefore you need to write some code. What have you written so far? Commented Oct 13, 2016 at 11:19
  • I have been able to extract individual characters using memoryview(): rows = arcpy.da.SearchCursor("Table","Comments") for row in rows: memview = memoryview(row[0]) print memview[2] Commented Oct 13, 2016 at 11:26
  • 2
    Please edit your question for any requested clarifications. Commented Oct 13, 2016 at 11:28

1 Answer 1

1

Reading Blobs:

from arcpy import da
import os
with da.SearchCursor(r"c:\temp\demo.gdb\table",['blobFieldname','fileName']) as cursor:
 for row in cursor:
 binaryRep = row[0]
 fileName = row[1]
 # save to disk
 open(r"c:\saveFolder" + os.sep + fileName, 'wb').write(binaryRep.tobytes())
 del row
 del binaryRep
 del fileName
answered Oct 13, 2016 at 15:25

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.