<?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: How do you: Reference SDE Data within Spatial Database Connection??? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182353#M14020</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From this link I see some differences in working with SDE vs geodatabases or shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Variables are assigned to create ArcSDE Connection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;These variables include password, version, and more&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then they use CreateArcSDEConnectionFile_management(Using these variables)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the end a MakeFeatureLayer_management() is used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I bet you can add the feature layer to a map after all of this is complete.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I seeing this right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are most of these steps necessary to simply add an SDE Feature Class to an mxd?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this was just a shapefile we could just use arcpy.mapping.AddLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I/we could use further insight if anyone has some. Thanks All&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Mar 2011 22:40:55 GMT</pubDate>
    <dc:creator>MAWashington</dc:creator>
    <dc:date>2011-03-17T22:40:55Z</dc:date>
    <item>
      <title>How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182351#M14018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can set my env.workspace to my SDE but have not figured out how to do anything with features that are in it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, if I can list my Feature Classes within the SDE and see what Versions are available.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I use or reference them?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to Add them to an existing mxd based on a query like OBJECTID = 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know how to do this if the Features are already in the mxd.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to access them directly from the SDE Spatial Database Connection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that I'm almost there, might just need a push in the right direction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, AP&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 18:09:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182351#M14018</guid>
      <dc:creator>AaronPaul</dc:creator>
      <dc:date>2011-03-17T18:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182352#M14019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Working with SDE data should be the same as working with any other data. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The path to the data can be slightly different but the behavior of the data should be the same. Take a look at this topic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002t0000000v000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002t0000000v000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 21:18:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182352#M14019</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2011-03-17T21:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182353#M14020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From this link I see some differences in working with SDE vs geodatabases or shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Variables are assigned to create ArcSDE Connection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;These variables include password, version, and more&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then they use CreateArcSDEConnectionFile_management(Using these variables)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the end a MakeFeatureLayer_management() is used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I bet you can add the feature layer to a map after all of this is complete.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I seeing this right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are most of these steps necessary to simply add an SDE Feature Class to an mxd?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this was just a shapefile we could just use arcpy.mapping.AddLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I/we could use further insight if anyone has some. Thanks All&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 22:40:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182353#M14020</guid>
      <dc:creator>MAWashington</dc:creator>
      <dc:date>2011-03-17T22:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182354#M14021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You do not need to create the connection file in Python. If you already have a connection file you can reference the existing file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example of adding a layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
addlayer = arcpy.mapping.Layer(r'Database Connections\Connection to database.sde\pythonDBO.GDB.houses')
arcpy.mapping.AddLayer(df, addlayer,"AUTO_ARRANGE")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:18:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182354#M14021</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2021-12-11T09:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182355#M14022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you once again Russell. I hope your solution works, will test and post back yeah or neah.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe a stupid question but here it is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you mean by already having a connection file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can make a connection in ArcCatalog, consume the data in ArcMap, and see the Feature Classes in python window using print fcList&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this mean I already have a connection?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your code below really simplifies the process, especially after trying to work through link seen below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesk...000v000000.htm"&gt;http://help.arcgis.com/en/arcgisdesk...000v000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So all I need to do is reference the Feature Class, then Add to mxd??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why do you think I can't do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What are some typical causes of not being able to reference the data or add it in this case?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your assistnace is greatly appreciated&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 15:41:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182355#M14022</guid>
      <dc:creator>MAWashington</dc:creator>
      <dc:date>2011-03-18T15:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182356#M14023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, you already have a connection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The connection files that you use to access your enterprise geodatabase through ArcMap/ArcCatalog/ArcGlobe etc. are the same files that you use to access your data through Python. These are the connections you create through ArcGIS Desktop when you go to 'Database Connections' &amp;gt; 'Add Database Connection'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you are working in ArcGIS Desktop you can think of these connection files as being the same as a file or personal geodatabase. You double click to view the contents and drag and drop contents from these connections into tools or into your map. The only difference is that the SDE Geodatabase has added functionality for managing permissions and editing transactions (more menu options). In Python this is the same story, you reference an existing SDE connection file the same way you reference a file or personal geodatabase 'connection'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can think of the 'createArcSDEConnectionFile' tool as something on par with the 'create file geodatabase' or 'create personal geodatabase' tools. You only &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;need &lt;/SPAN&gt;&lt;SPAN&gt;to use these tools if your 'connection' (aka file or personal geodatabase or sde connection file) does not already. However if you have database connections or existing file or personal geodatabases you do not need to create them in every script that you write.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not know why this is not working. I will need some more information to assist in answering that. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- What is the Python code you are using?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- What DBMS are you using (Oracle, SQL Server, PostGres, DB2, Informix)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- What error messages are you getting?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 16:27:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182356#M14023</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2011-03-18T16:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182357#M14024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is excellent information and hopefully exactly what I need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What you're saying is that I already have the connection which is why I'm seeing versions and all of the Feature Classes within my SDE.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is that I've only been able to view them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't figured out how to reference them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've become fairly familiar with arcpy using file geodatabases and shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I thought I'd be able to do something with the SDE Feature Classes but am unsuccesful at this point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll post the items you requested this evening after testing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I have a connection, I should be able to easily add a layer to an mxd but can't.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For now, that's all I want to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Once I get a solid hook, I can perform queries and graduate to next levels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your help is greatly appreciated Russell.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 22:50:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182357#M14024</guid>
      <dc:creator>MAWashington</dc:creator>
      <dc:date>2011-03-18T22:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you: Reference SDE Data within Spatial Database Connection???</title>
      <link>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182358#M14025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good Afternoon ALL-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The solution was here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;addlayer = arcpy.mapping.Layer(r'Database Connections\Connection to database.sde\pythonDBO.GDB.houses')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.AddLayer(df, addlayer,"AUTO_ARRANGE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My bad, as I was not assigning the layer, then adding to map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much Russell for further explaining.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your last posts really brought clarity to my oversight.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2011 19:25:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-you-reference-sde-data-within-spatial/m-p/182358#M14025</guid>
      <dc:creator>MAWashington</dc:creator>
      <dc:date>2011-03-21T19:25:36Z</dc:date>
    </item>
  </channel>
</rss>

