<?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: Is it possible to export data from SDE using python? in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355477#M2268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Christian, I think that is exactly what I'm looking for. Appreciate the help and the example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Dec 2016 12:42:50 GMT</pubDate>
    <dc:creator>ScottMcGee1</dc:creator>
    <dc:date>2016-12-06T12:42:50Z</dc:date>
    <item>
      <title>Is it possible to export data from SDE using python?</title>
      <link>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355473#M2264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd like to save the end user numerous steps to export data saved in the SDE database. &amp;nbsp;Right now they export the data as a shapefile, open the DBF in excel and save that to CSV so they can use the mail merge function in Word to populate inspection forms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 19:20:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355473#M2264</guid>
      <dc:creator>ScottMcGee1</dc:creator>
      <dc:date>2016-12-05T19:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to export data from SDE using python?</title>
      <link>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355474#M2265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott, this should be relatively easy using arcpy.da.SearchCursor and csv.writer. If you create the cursor to search the rows, you can simply append them to a CSV. The nice thing about this is that you can open a writer object for CSV then iterate over the rows of the SDE table to read the row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/data-access/searchcursor-class.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/data-access/searchcursor-class.htm"&gt;SearchCursor—Data Access module | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.python.org/2/library/csv.html" title="https://docs.python.org/2/library/csv.html"&gt;13.1. csv — CSV File Reading and Writing — Python 2.7.13 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 21:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355474#M2265</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2016-12-05T21:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to export data from SDE using python?</title>
      <link>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355475#M2266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;at least one step simplified if you don't need geometry&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/conversion-toolbox/excel-to-table.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/conversion-toolbox/excel-to-table.htm"&gt;Excel To Table—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 22:17:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355475#M2266</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-12-05T22:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to export data from SDE using python?</title>
      <link>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355476#M2267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a sample of what I was talking about above. Let me know if you have any questions on this.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; csv

&lt;SPAN class="comment token"&gt;#SDE Feature Class&lt;/SPAN&gt;
fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"Database Connections\sdefile.sde\SDE.us_cities"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Open CSV file&lt;/SPAN&gt;
csvfile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'c:\tmp\us_cities.csv'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'wb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Create CSV Writer&lt;/SPAN&gt;
csvwriter &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; csv&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;csvfile&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Write header to CSV file&lt;/SPAN&gt;
csvwriter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writerow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CITY_FIPS'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CITY_NAME'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'STATE_NAME'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Loop through SDE FC and collect specific fields&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'OID@'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CITY_FIPS'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CITY_NAME'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'STATE_NAME'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;#Write rows to CSV based on SearchCursor results&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; csvwriter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writerow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:39:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355476#M2267</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2021-12-11T16:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to export data from SDE using python?</title>
      <link>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355477#M2268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Christian, I think that is exactly what I'm looking for. Appreciate the help and the example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2016 12:42:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/is-it-possible-to-export-data-from-sde-using/m-p/355477#M2268</guid>
      <dc:creator>ScottMcGee1</dc:creator>
      <dc:date>2016-12-06T12:42:50Z</dc:date>
    </item>
  </channel>
</rss>

