<?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 Setting the workspace to SDE in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/setting-the-workspace-to-sde/m-p/714115#M55381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My script works as intended when the workspace and variables are set to a File Geodatabase, but not when connecting to SDE.&amp;nbsp;&amp;nbsp;&amp;nbsp; The commented out lines show how the script runs when connecting to a File Geodatabase vs. my SDE setup.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The end result is a csv file.&amp;nbsp; Using the SDE setup calls the sub layer and outputs the correct results, but does not write out par layer results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
import getpass

#Workspace
#arcpy.env.workspace = "H:\\Python\\Python.gdb" #File Geodatabase
arcpy.env.workspace = "Database Connections\\Connection_to_sde2.sde" #SDE

#Variables
mxd = arcpy.mapping.MapDocument ("CURRENT")
df = arcpy.mapping.ListDataFrames (mxd)[0] 
#sub = arcpy.mapping.ListLayers(mxd, "Subdivisions", df)[0] #File Geodatabase
#par = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0] #File Geodatabase
sub = arcpy.mapping.ListLayers(mxd, "LIBRARIAN.Subdivisions", df)[0] #SDE
par = arcpy.mapping.ListLayers(mxd, "LIBRARIAN.Parcels", df)[0] #SDE&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Apr 2014 13:02:51 GMT</pubDate>
    <dc:creator>JacobDrvar</dc:creator>
    <dc:date>2014-04-18T13:02:51Z</dc:date>
    <item>
      <title>Setting the workspace to SDE</title>
      <link>https://community.esri.com/t5/python-questions/setting-the-workspace-to-sde/m-p/714115#M55381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My script works as intended when the workspace and variables are set to a File Geodatabase, but not when connecting to SDE.&amp;nbsp;&amp;nbsp;&amp;nbsp; The commented out lines show how the script runs when connecting to a File Geodatabase vs. my SDE setup.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The end result is a csv file.&amp;nbsp; Using the SDE setup calls the sub layer and outputs the correct results, but does not write out par layer results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
import getpass

#Workspace
#arcpy.env.workspace = "H:\\Python\\Python.gdb" #File Geodatabase
arcpy.env.workspace = "Database Connections\\Connection_to_sde2.sde" #SDE

#Variables
mxd = arcpy.mapping.MapDocument ("CURRENT")
df = arcpy.mapping.ListDataFrames (mxd)[0] 
#sub = arcpy.mapping.ListLayers(mxd, "Subdivisions", df)[0] #File Geodatabase
#par = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0] #File Geodatabase
sub = arcpy.mapping.ListLayers(mxd, "LIBRARIAN.Subdivisions", df)[0] #SDE
par = arcpy.mapping.ListLayers(mxd, "LIBRARIAN.Parcels", df)[0] #SDE&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2014 13:02:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-the-workspace-to-sde/m-p/714115#M55381</guid>
      <dc:creator>JacobDrvar</dc:creator>
      <dc:date>2014-04-18T13:02:51Z</dc:date>
    </item>
  </channel>
</rss>

