<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extract Feature Attachments in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212625#M16369</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had already promoted both of these ideas weeks ago.&amp;nbsp; Now I am hoping that other GIS users will join the bandwagon so that ESRI see the need for this additional functionality.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Nov 2013 12:59:34 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2013-11-18T12:59:34Z</dc:date>
    <item>
      <title>Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212614#M16358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"Feature attachments" is the new feature from ArcGIS 10 on wards. How to extract feature attachments and save to disk using Python?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2013 08:13:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212614#M16358</guid>
      <dc:creator>Ranga_Tolapi</dc:creator>
      <dc:date>2013-10-24T08:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212615#M16359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;"Feature attachments" is the new feature from ArcGIS 10 on wards. How to extract feature attachments and save to disk using Python?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this blogpost (please read):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://anothergisblog.blogspot.nl/2012/06/working-with-blob-data-at-101-arcpyda.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://anothergisblog.blogspot.nl/2012/06/working-with-blob-data-at-101-arcpyda.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... a nice example is included of how to read attachments:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from arcpy import da
import os
with da.SearchCursor(r"c:\temp\demo.gdb\table",['blobFieldname','fileName']) as cursor:
&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binaryRep = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save to disk
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open(r"c:\saveFolder" + os.sep + fileName, 'wb').write(binaryRep.tobytes())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del binaryRep
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del fileName&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can find more on Cursor and blob fields (scroll down to end of page) through this link:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002z0000001q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//002z0000001q000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:27:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212615#M16359</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T10:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212616#M16360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Xander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your response.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually I was looking about "Feature Attachments", which involves a relationship table to store the attachments for features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please go through "Query attachments" section in below link, which talks about performing the same task in .Net.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000001qr000000"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000001qr000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 13:07:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212616#M16360</guid>
      <dc:creator>Ranga_Tolapi</dc:creator>
      <dc:date>2013-10-29T13:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212617#M16361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Xander,&lt;BR /&gt;&lt;BR /&gt;Thanks for your response.&lt;BR /&gt;&lt;BR /&gt;Actually I was looking about "Feature Attachments", which involves a relationship table to store the attachments for features.&lt;BR /&gt;&lt;BR /&gt;Please go through "Query attachments" section in below link, which talks about performing the same task in .Net.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000001qr000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000001qr000000&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python is more limited than ArcObjects (although you could implement COM types in Python and use ArcObjects). If you only want to save the attachments and not use any related data from the features then the code remains mostly the same:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from arcpy import da
import os
# fc = r"C:\Project\_LearnPython\Attachments\test.gdb\yourFCname"
tbl = r"C:\Project\_LearnPython\Attachments\test.gdb\&lt;STRONG&gt;yourFCname__ATTACH&lt;/STRONG&gt;"
fldBLOB = 'DATA'
fldAttName = 'ATT_NAME'
outFolder = r"C:\Project\_LearnPython\Attachments"

with da.SearchCursor(tbl,[fldBLOB,fldAttName]) as cursor:
&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binaryRep = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save to disk
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open(outFolder + os.sep + fileName, 'wb').write(binaryRep.tobytes())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del binaryRep
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del fileName&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case you access the attachment tabel ("&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;yourFCname__ATTACH&lt;/SPAN&gt;&lt;SPAN&gt;"). The name of the attachment is stored in the field "ATT_NAME" and the binary data in the field "DATA".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to access the feature itself, you will have to use the "REL_OBJECTID" field from the attachment table and query the featureclass on OBJECTID = REL_OBJECTID...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:27:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212617#M16361</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T10:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212618#M16362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Xander, appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try this later, as I am busy with my other critical tasks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2013 14:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212618#M16362</guid>
      <dc:creator>Ranga_Tolapi</dc:creator>
      <dc:date>2013-10-29T14:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212619#M16363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How would I go about added the relationship data into my python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"If you want to access the feature itself, you will have to use the "REL_OBJECTID" field from the attachment table and query the featureclass on OBJECTID = REL_OBJECTID..." &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know you mentioned this way, but since it is a relationship does it need to be pathed to a geodatabase? Or how does it pull the relationship information with the pictures?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Nick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 12:36:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212619#M16363</guid>
      <dc:creator>NicholasKnabe</dc:creator>
      <dc:date>2013-11-15T12:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212620#M16364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Xander:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would you be able to extend your code in python to be able to access images already stored as a BLOB field in SQL Server 2012 (non-GIS) as attachments without having to copy the images into ESRI feature classes thus eliminating data duplication of attachment files?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 13:13:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212620#M16364</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-11-15T13:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212621#M16365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How would I go about added the relationship data into my python script.&lt;BR /&gt;&lt;BR /&gt;"If you want to access the feature itself, you will have to use the&amp;nbsp; "REL_OBJECTID" field from the attachment table and query the&amp;nbsp; featureclass on OBJECTID = REL_OBJECTID..." &lt;BR /&gt;&lt;BR /&gt;I know you mentioned this way, but since it is a relationship does it&amp;nbsp; need to be pathed to a geodatabase? Or how does it pull the relationship&amp;nbsp; information with the pictures?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Nicholas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would like to access the related information the belongs to the attachment, you will have to use the REL_OBJECTID in the attachment table to query the feature class. In the code below I created a function "QueryRelatedData" that retrieves information from the feature class. If the related OID = 2, the expression will be "OBJECTID = 2", which is used as a query definition to only extract 1 feature. Next the attribute in the field "&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;SomeFieldInFeatureClass&lt;/SPAN&gt;&lt;SPAN&gt;" is accessed and returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't test the code below, so be careful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; global arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy, os

&amp;nbsp;&amp;nbsp;&amp;nbsp; # fixed settings
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldBLOB = 'DATA'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldAttName = 'ATT_NAME'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldRelOID = 'REL_OBJECTID'

&amp;nbsp;&amp;nbsp;&amp;nbsp; # your settings (&lt;STRONG&gt;edit these&lt;/STRONG&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = r"C:\Project\_LearnPython\Attachments\test.gdb\Meldingen"
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl = r"C:\Project\_LearnPython\Attachments\test.gdb\Meldingen__ATTACH"
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFolder = r"C:\Project\_LearnPython\Attachments"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldRelatedInfo = 'SomeFieldInFeatureClass' # should be valid column in FC

&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(tbl,[fldBLOB,fldAttName,fldRelOID]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binaryRep = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relOID = row[2]

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # access related information
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myRelatedInfo = QueryRelatedData(fc, fldRelatedInfo, relOID)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something with the related info

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save attachment to disk
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open(outFolder + os.sep + fileName, 'wb').write(binaryRep.tobytes())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del binaryRep
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del fileName


def &lt;STRONG&gt;QueryRelatedData&lt;/STRONG&gt;(fc, fldRelatedInfo, relOID):
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldOID = 'OBJECTID'
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(fc, fldOID) + " = {0}".format(relOID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc, (fldOID, fldRelatedInfo), where_clause=expression) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:27:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212621#M16365</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T10:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212622#M16366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Would you be able to extend your code in python to be able to access&amp;nbsp; images already stored as a BLOB field in SQL Server 2012 (non-GIS) as&amp;nbsp; attachments without having to copy the images into ESRI feature classes&amp;nbsp; thus eliminating data duplication of attachment files?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you explain this a little more? Do you have images stored in SQL Server 2012, and you want to use them as attachment, without the need to convert them to an Esri attachment table? If that's the case, I don't think ArcGIS will recognize them as attachments. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would like to extract the BLOB attachments stored in SQL Server 2012 by code, I think you should be able to do so. If the SQL Server 2012 table can be accessed by ArcGIS, you can loop through it and extract the attachments (like in the code, save it to disk). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After saving the files to disk, I guess you can use "&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000157000000"&gt;Generate Attachment Match Table (Data Management)&lt;/A&gt;&lt;SPAN&gt;" and Add the attachments (which would duplicate or "triplicate" the data). More on this in the Help topic "&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000017z000000"&gt;Working with the Attachments geoprocessing tools&lt;/A&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure, if this is the answer you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Nov 2013 06:06:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212622#M16366</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2013-11-18T06:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212623#M16367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not a Database Administrator (DBA), but the DBAs at my organization are always trying to minimize unnecessary data duplication which seems what is occurring with the attachments if you already have the data stored in another format other than feature classes that recognize attachments.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't you think it would be more efficient if attachments could just be created in the native format that the original attachment files were stored in?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Nov 2013 11:46:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212623#M16367</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-11-18T11:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212624#M16368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The DBAs (and you) are right; data duplication creates a lot of extra work (apart from the additional data storage). Maybe in the future we'll see some extra functionality in ArcGIS allowing us to create attachments in the form of "hyperlinks" to existing data. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see two ideas that kinda want the same as you're proposing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://ideas.arcgis.com/ideaView?id=087E00000004H2CIAU"&gt;Geodatabase Attachments for large organizations &lt;/A&gt;&lt;BR /&gt;&lt;A href="http://ideas.arcgis.com/ideaView?id=087E00000004rnqIAA"&gt;Geodatabase Attachments Storage Location Option &lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think we should promote those ideas.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Nov 2013 12:22:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212624#M16368</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2013-11-18T12:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212625#M16369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had already promoted both of these ideas weeks ago.&amp;nbsp; Now I am hoping that other GIS users will join the bandwagon so that ESRI see the need for this additional functionality.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Nov 2013 12:59:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212625#M16369</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-11-18T12:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212626#M16370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using 10.0, which as far as I know doesn't/can't use the arcpy.da module.&amp;nbsp; How then would I go about extracting image attachments to disk without that module?&amp;nbsp; Any feedback is greatly appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 09:24:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212626#M16370</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-08-28T09:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212627#M16371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The functionality to extract the feature attachments is not limited to the da.cursor. The syntax will be different. The help provides some examples of how to use the cursor in 10.0:&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000039000000" title="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000039000000"&gt;ArcGIS Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have problems creating the proper syntax let me know and I will add the code sample for 10.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 03:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212627#M16371</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-08-29T03:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212628#M16372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A code sample for 10.0 would be great, thank you.&amp;nbsp; I'm also wondering if there's a way using 10.0 to access attachments from a service and extract them to a local disk.&amp;nbsp; Everything I've found on this type of operation is for 10.1 an above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 09:03:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212628#M16372</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-09-02T09:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212629#M16373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Observe code sample below. Once again I haven't tested the code, so be careful.&lt;/P&gt;&lt;P&gt;Changes in syntax can be found on lines 16, 18-20 + 35 and 37&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14097629294946144 jive_text_macro" jivemacro_uid="_14097629294946144"&gt;
&lt;P&gt;def main():&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; global arcpy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy, os&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # fixed settings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldBLOB = 'DATA'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldAttName = 'ATT_NAME'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldRelOID = 'REL_OBJECTID'&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # your settings (edit these)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = r"C:\Project\_LearnPython\Attachments\test.gdb\Meldingen"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl = r"C:\Project\_LearnPython\Attachments\test.gdb\Meldingen__ATTACH"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFolder = r"C:\Project\_LearnPython\Attachments"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldRelatedInfo = 'SomeFieldInFeatureClass' # should be valid column in FC&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.SearchCursor(tbl) as cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binaryRep = row.getValue(fldBLOB)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName = row.getValue(fldAttName)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relOID = row.getValue(fldRelOID)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # access related information&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myRelatedInfo = QueryRelatedData(fc, fldRelatedInfo, relOID)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something with the related info&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save attachment to disk&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open(outFolder + os.sep + fileName, 'wb').write(binaryRep.tobytes())&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del binaryRep&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del fileName&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;def QueryRelatedData(fc, fldRelatedInfo, relOID):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fldOID = 'OBJECTID'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(fc, fldOID) + " = {0}".format(relOID)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.SearchCursor(fc, where_clause=expression) as cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return row.getValue(fldRelatedInfo)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if __name__ == '__main__':&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 16:50:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212629#M16373</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-09-03T16:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212630#M16374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for taking the time to post this, I appreciate it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2014 08:27:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212630#M16374</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-09-04T08:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212631#M16375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For anyone who is still looking for answers on extracting attachments from a secured ArcGIS online-hosted feature service:&amp;nbsp; I've been working with Brian Brown (who has been helpful byond the call of duty) on developing a script that I can use to download attachments and replicate the entire hosted feature service locally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian's base code can be found on his github site: &lt;A class="jive-link-external-small" href="https://github.com/bgeomapping/arcgis-toolboxes" rel="nofollow" target="_blank"&gt;https://github.com/bgeomapping/arcgis-toolboxes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made some minor modifications to it, which are included in the attached code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Functionality to create a directory for attachments and another for the spatial data.&lt;/LI&gt;&lt;LI&gt;Functionality for unzipping and renaming the replicated geodatabase.&lt;/LI&gt;&lt;LI&gt;I need this to run daily and delete the download from 'yesterday', so I added functionality for that.&lt;/LI&gt;&lt;LI&gt;I also wanted to have the global id in the file name, and for it to add a file extension to the attachment even if one wasn't included as part of the the file name -- functionality for that is added.&lt;/LI&gt;&lt;LI&gt;As far as I can tell the base code works only for images, but since attachments can be virtually any format, I modified the code to handle any format.&lt;/LI&gt;&lt;LI&gt;Generate a report showing number of attachments downloaded per layer in feature service.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other things to note: if the specified url ends in FeatureServer, the entire service will be replicated and all attachments for all layers with attachments in the service will be downloaded.&amp;nbsp; If the specified url ends in FeatureServer/&amp;lt;layer index&amp;gt;, only that layer will be replicated and only attachments for that layer will be downloaded.&amp;nbsp; Also, the code creates the following subdirectories for attachments:&amp;nbsp; Layer &amp;gt; Feature OID &amp;gt; attachments, as well as an 'All attachments' folder -- I don't need the 'All attachments' portion, so it's commented out.&amp;nbsp; This should work in both Python 2.6 and 2.7 (I've tested in 2.6, Brian in 2.7) and is written so that ArcGIS need not be installed on the machine running the script (in other words, no arcpy import).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps some of you!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Trill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 15:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212631#M16375</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-10-07T15:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212632#M16376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working with this code sample in 10.2 to access related information from downloaded attachments.&amp;nbsp; The first problem I'm running into is that my myFeatureClass_ATTACH has no REL_OBJECTID field, only a REL_GLOBALID field.&amp;nbsp; When I adjust the code to use the expression to match the global id's instead of the object id's, I'm getting the following error:&lt;IMG alt="sqlerror.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/36288_sqlerror.PNG" style="width: 620px; height: 94px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure why it's still trying to select OBJECTID, which is maybe the problem (?) -- anyway, see my modified code below.&amp;nbsp; Please let me know if you have any ideas.&amp;nbsp; Any guidance is much appreciated!&amp;nbsp; Thanks -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trill&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; global arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy, os

&amp;nbsp;&amp;nbsp;&amp;nbsp; # fixed settings
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldBLOB = 'DATA'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldAttName = 'ATT_NAME'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldRelGID = 'REL_GLOBALID'

&amp;nbsp;&amp;nbsp;&amp;nbsp; # your settings (edit these)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ## related feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = r"C:\Forstmobil_2014.12.01\Geodaten\Forstmobil_2014.12.01.gdb\Baumkontrolle_AGS_online"
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## attachment table
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl = r"C:\Forstmobil_2014.12.01\Geodaten\Forstmobil_2014.12.01.gdb\Baumkontrolle_AGS_online__ATTACH
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldRelatedInfo = 'CreationDate' # should be valid column in FC

&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(tbl,[fldBLOB,fldAttName,fldRelGID]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binaryRep = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relGID = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # access related information
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myRelatedInfo = QueryRelatedData(fc, fldRelatedInfo, relGID)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print myRelatedInfo

def QueryRelatedData(fc, fldRelatedInfo, relGID):
&amp;nbsp;&amp;nbsp;&amp;nbsp; fldGID = 'GlobalID'
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = arcpy.AddFieldDelimiters(fc, fldGID) + " = {0}".format(relGID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc, (fldGID, fldRelatedInfo), where_clause=expression) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:27:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212632#M16376</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2021-12-11T10:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Feature Attachments</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212633#M16377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strange, in your code there is no reference to the OBJECTID field. Maybe due to the attachments it is trying to include it, but if the relationship is based on GlobalID, then there will be no OBJECTID (?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing I saw missing is the quote at the end of line 14 (but I think that is a copy error).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2014 16:13:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-attachments/m-p/212633#M16377</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-12-01T16:13:13Z</dc:date>
    </item>
  </channel>
</rss>

