0

Looking at this page for getting Workspace Properties I am wondering if there is a simple way to get a Users password from an existing SDE connection on the users machine?

Using the code sample from the aforementioned link, something like this:

desc = arcpy.Describe(r"C:data\Connection to state.sde")
cp = desc.connectionProperties
print("%-12s %s" % (" Password:", cp.password))

For clarification this is for a custom Python Script Tool that creates a new SDE connection as part of the code. Currently I have the user enter their user name and pword in the tool prompt. If I could however have them simply select an existing database connection on their machine and use the creds from that it would be much simpler and less error prone.

I do not think this presents a security risk because it would only have local application. A user would be accessing their own info to automate a process on their personal machine.

There are both Oracle and SQL Servers, I will put logic into the tool that will differentiate between the two.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Apr 20, 2018 at 18:13
0

1 Answer 1

1

You can't, the password is stored encrypted in the connection file and is not exposed as a connection property.

The only properties you can query are listed in the documentation you linked to.

What you could do is either have them input credentials and create a new connection or just reuse the existing connection.

answered Apr 20, 2018 at 23:44
1
  • That was my assumption but I thought I would put it out there. Thanks. Commented Apr 23, 2018 at 15:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.