Select to view content in your preferred language

Use a sde connection file to read future class, database tables from a SQL server

284
2
Jump to solution
02-20-2025 06:43 AM
TheSecondDude
Emerging Contributor

Hello,

I am new to using our brand-new python notebook server (in Arcgis Enterprise portal).


So in the past when I was using ArcGis pro I used my sde connection (SQL Server) which had a list of all my database tables, enterprise geodatabase future class,....

And I wanted to easily connect again to my data so I followed the steps here to use my sde connection https://enterprise.arcgis.com/en/portal/latest/use/add-data-store-item.htm I successfully uploaded the sde file on the content of the Enterprise portal so it's now available as a Data Store.


So now in the notebook I can drag it and will automatic generate (I replaced some sensitive data with *):

 

 

# Item Added From Toolbar
# Title: GIS_one | Type: Data Store | Owner: ******
item = gis.content.get("***********")
item

 

 

So, my question is how can I open my data store (sde) so I can see the enterprise geodatabase future class, database tables, ... like I could see in ArcGis Pro when I opened my sde connection.
so I can edit or read my enterprise geodatabase future class.

thx

0 Kudos
1 Solution

Accepted Solutions
TheSecondDude
Emerging Contributor

Hey

thank you for your reply.
The problem was after I uploaded my sde file in my content of the portal, I still had to sync the layers. Which I was unaware off.

So, after clicking on the button "sync layers" all my layers became visible and accessible.

 

TheSecondDude_0-1740729058308.png

 

View solution in original post

0 Kudos
2 Replies
MatthewDriscoll
MVP Alum

Are you asking how to connect to your sde using python?

 

# Set up connection
sdeTempPath = tempfile.mkdtemp()
connect = arcpy.management.CreateDatabaseConnection(
    sdeTempPath,
    'ConnName.sde',
    'SQL_SERVER',
    'INSTANCE',
    'DATABASE_AUTH',
    'USER',
    'PASSWORD',
    'SAVE_USERNAME',
    'DataBase'
)

# Use a temporary workspace
arcpy.env.workspace = os.path.join(sdeTempPath, "ConnName.sde")

 

0 Kudos
TheSecondDude
Emerging Contributor

Hey

thank you for your reply.
The problem was after I uploaded my sde file in my content of the portal, I still had to sync the layers. Which I was unaware off.

So, after clicking on the button "sync layers" all my layers became visible and accessible.

 

TheSecondDude_0-1740729058308.png

 

0 Kudos