Python – Define Workspace for SDE Connection

One of the possiblilities is to provide the full path to the sde connection file. You can check it creating the connection in ArcCatalog then right clicking and selecting Properties.


C:\Python26\ArcGIS10.0>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> arcpy.env.workspace="C:\Users\osedok\AppData\Roaming\ESRI\
Desktop10.0\Arc
Catalog\PABLO to TEST_SDE_SERVER.sde"
>>> dataset_list=arcpy.ListDatasets()
>>> for feature_dataset in dataset_list:
...     print feature_dataset
...
MASTERMAP.ITN_Network
PABLO.Administrative
PABLO.Default_Blank_Dataset
PABLO.Default_Dataset
PABLO.Development
>>>

Published by

osedok

I am interested in Android and Web development, Open Street Map editing and looking for new things connected to the maps and spatial data. I enjoy making stuff and understanding how the stuff works. I can code in many programming languages and I am really having fun of it. When having free time I am taking care of my apps and write some content on my blog. I enjoy the countryside, which is giving me opportunities for photography. My favourite motto from Albert Einstein is: "If you can't explain it simply, you don't understand it well enough."

What do you think?