Running fuction on a on a feature class in an enterprise geodatabase via Jupyter.

460
4
Jump to solution
03-05-2021 12:41 PM
Laura_m_Conner
New Contributor II

All,

How do I run functions such as the select by attribute (arcpy.management.SelectLayerByAttribute) on a feature class in an enterprise geodatabase via Jupyter in Arc Pro? I can run functions via Jupyter on  shapefiles and regular geodatabase but not on enterprise geodatabase.  For now i just poking around Jupyter Notebooks, but any future applications of the Notebooks must be capable of using data from our enterprise geodatabase.

Arcpro: 2.7.1

Thank you

0 Kudos
1 Solution

Accepted Solutions
DavinWalker2
Esri Contributor

Hi Laura,

Get the path to the Enterprise geodatabase .sde file. Example below.

import arcpy

arcpy.management.SelectLayerByAttribute(r"C:\pathtodatabase.sde\featureclass", "NEW_SELECTION", "NAME = 'Bob' And AGE = '30'", None)

 

 

View solution in original post

4 Replies
DavinWalker2
Esri Contributor

Hi Laura,

Get the path to the Enterprise geodatabase .sde file. Example below.

import arcpy

arcpy.management.SelectLayerByAttribute(r"C:\pathtodatabase.sde\featureclass", "NEW_SELECTION", "NAME = 'Bob' And AGE = '30'", None)

 

 

View solution in original post

Laura_m_Conner
New Contributor II

Thank you, I will try it out as soon as I get the chance.

0 Kudos
Laura_m_Conner
New Contributor II

 

Davin,

How do i get the the path to the Enterprise geodatabase .sde file? For now I do not necessary need to do this in python/Juypter but being able to have a script that can run on mutable computers wold be nice.

Thank you,

0 Kudos
JeffK
by
Regular Contributor

If it is ArcMap, they are located in

C:\Users\<username>\AppData\Roaming\ESRI\<Desktop10.x>\ArcCatalog

If they are Pro... they are stored in the project so they will be wherever that project is saved. 

To get around Pro's isolationism, I created a folder that is accessible to everyone and keep the common connection files in it.

0 Kudos