I would like to be able to use a database connection to get workspace properties from Describe. Using Pro 3.1.3, accessing any of the workspace properties everything results in
OSError: "CIMDATA=<CIMStandardDataConnection xsi:type=...rest of connection string" does not exist
If I'm building paths to layers and tables in a script, I sometimes use Describe to get workspace information from one layer to build another. It's also helpful in debugging.
Here's a question discussion for reference.
Thank you for submitting your idea to describe connection strings using ArcPy's Describe methods. We appreciate your suggestion and the time you took to provide detailed feedback. ArcPy Describe is designed to work with data sources (direct paths to data) and ArcPy objects, but not with arbitrary strings. Dealing with arbitrary strings would add significant overhead. To get the description of a database connection, please continue using the result of Create Database Connection (Data Management)—ArcGIS Pro | Documentation or an existing .sde file. After careful consideration, we regret to inform you that we will not be implementing this idea at this time.
Thank you again for your contribution and understanding.
@HannesZiegler
I understand why this idea was closed, but I think you might consider to add the ability to use a connection string with the arcpy.management.CreateDatabaseConnection method. Otherwise, I dont understand what could be the utility of the connection string at all. I dont find any documentation about how to use a connection string and many arcpy function I have try juste does not works with connection string.
@MaximeDemers, thanks for the response. I did a bit of investigation here and wanted to check back in to see if the current software meets your needs.
You requested the ability to use a connection string as input to Describe so that you could retrieve workspace level information. I do see this functionality existing in ArcGIS Pro 3.4. Can you share what version you are currently operating in? I've included a code sample below that shows how I get workspace info from a connection string. Is this the functionality that you are requesting?
platform = <dmbs_pltform>
instance = <instance_name>
account_authentication = <auth_type>
username = <user_name>
password = <password>
database = <database_name>
object_name = <dataset_name>
result = arcpy.management.CreateDatabaseConnectionString(
platform,
instance
account_authentication,
username,
password,
database,
object_name
)
wksp_object = arcpy.Describe(result).workspace
@SSWoodward
Thank you for your reply. I am glad this functionnality was added in the latest ArcGIS Pro release.
Thank you @MaximeDemers and @SSWoodward, closing this idea again as per conversation above
I was hoping to add a comment to this idea, despite it being closed, because all the context is already right here...
I think there's great value in being able to generate a connection string to a workspace (e.g. an enterprise geodatabase) WITHOUT specifying a particular object in that geodatabase. It could then be used later on in the script as a general purpose workspace object, without having to actually point to, or construct a database connection file somewhere on disk.
@SSWoodward your sample script above only works if the "object_name" parameter is specified. If the object_name is omitted, the Describe statement does not recognize the connection string as a valid workspace. So, in one case, Describe recognizes the connection string, but in the other, it does not. So, the Describe command seems to be OK working with a CIMStandardDataConnection xml string , but only when that string points to a specific object.
Thanks for the ping @JC_LAURENCE. I totally understand your request.
Database connection strings are strings used to connect to a specific dataset within a database. Whether that be a feature dataset, feature class or table. It seems like your Idea is to allow for a string or memory SDE connection to a whole geodatabase. That's different enough from the idea were in now that it would be best to open a new idea for that functionality.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.