<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Workspace describe.connectionProperties vs Layer.connectionProperties in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/workspace-describe-connectionproperties-vs-layer/m-p/1198290#M65110</link>
    <description>&lt;P&gt;I am confused by these two.&amp;nbsp; They may contain similar information but the ways to get the values out of them seem a bit different.&lt;/P&gt;&lt;P&gt;The Pro help states clearly:&amp;nbsp;&amp;nbsp;Layer.connectionProperties is&amp;nbsp;&lt;SPAN&gt;a layer's data source connection information as a &lt;STRONG&gt;Python dictionary.&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;Workspace describe.&lt;SPAN class=""&gt;connectionProperties&amp;nbsp;&lt;/SPAN&gt;is a &lt;STRONG&gt;property set&lt;/STRONG&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I do not understand the difference of getting values out of them.&amp;nbsp; See sample code below.&amp;nbsp; Thanks.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the sample code to get layer connection properties:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;conn_prop=layer.connectionProperties&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;conn_info=conn_prop['connection_info']&amp;nbsp; #db_connection_properties']&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;instance =conn_info['db_connection_properties']&amp;nbsp; #giswpddev&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;print(conn_info)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;version=conn_info['version']&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;print (version)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;print(instance)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Print(conn_prop)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="3"&gt;Here is the sample code workspace describe connection properties:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;desc=arcpy.Describe(workspace_sde)&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-24s %s" % ("Connection String:", desc.connectionString))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-24s %s" % ("WorkspaceFactoryProgID:", desc.workspaceFactoryProgID))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-24s %s" % ("Workspace Type:", desc.workspaceType))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;cp = desc.connectionProperties&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print(cp)&amp;nbsp; &amp;nbsp;#this return an empty object&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("\nDatabase Connection Properties:")&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; Server:", cp.server))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; Instance:", cp.instance))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;#print("%-12s %s" % ("&amp;nbsp; Database:", cp.database))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; User:", cp.user))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; Version:", cp.version))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2022 21:31:06 GMT</pubDate>
    <dc:creator>YinghongLi1</dc:creator>
    <dc:date>2022-08-01T21:31:06Z</dc:date>
    <item>
      <title>Workspace describe.connectionProperties vs Layer.connectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/workspace-describe-connectionproperties-vs-layer/m-p/1198290#M65110</link>
      <description>&lt;P&gt;I am confused by these two.&amp;nbsp; They may contain similar information but the ways to get the values out of them seem a bit different.&lt;/P&gt;&lt;P&gt;The Pro help states clearly:&amp;nbsp;&amp;nbsp;Layer.connectionProperties is&amp;nbsp;&lt;SPAN&gt;a layer's data source connection information as a &lt;STRONG&gt;Python dictionary.&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;Workspace describe.&lt;SPAN class=""&gt;connectionProperties&amp;nbsp;&lt;/SPAN&gt;is a &lt;STRONG&gt;property set&lt;/STRONG&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I do not understand the difference of getting values out of them.&amp;nbsp; See sample code below.&amp;nbsp; Thanks.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the sample code to get layer connection properties:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;conn_prop=layer.connectionProperties&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;conn_info=conn_prop['connection_info']&amp;nbsp; #db_connection_properties']&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;instance =conn_info['db_connection_properties']&amp;nbsp; #giswpddev&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;print(conn_info)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;version=conn_info['version']&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;print (version)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;print(instance)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Print(conn_prop)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;FONT size="3"&gt;Here is the sample code workspace describe connection properties:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;desc=arcpy.Describe(workspace_sde)&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-24s %s" % ("Connection String:", desc.connectionString))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-24s %s" % ("WorkspaceFactoryProgID:", desc.workspaceFactoryProgID))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-24s %s" % ("Workspace Type:", desc.workspaceType))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;cp = desc.connectionProperties&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print(cp)&amp;nbsp; &amp;nbsp;#this return an empty object&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("\nDatabase Connection Properties:")&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; Server:", cp.server))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; Instance:", cp.instance))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;#print("%-12s %s" % ("&amp;nbsp; Database:", cp.database))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; User:", cp.user))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2"&gt;print("%-12s %s" % ("&amp;nbsp; Version:", cp.version))&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 21:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/workspace-describe-connectionproperties-vs-layer/m-p/1198290#M65110</guid>
      <dc:creator>YinghongLi1</dc:creator>
      <dc:date>2022-08-01T21:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Workspace describe.connectionProperties vs Layer.connectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/workspace-describe-connectionproperties-vs-layer/m-p/1198314#M65112</link>
      <description>&lt;P&gt;I think you do understand the different ways of getting information out of them because you have provided sample code demonstrating how to extract connection properties from both.&amp;nbsp; If your confusion is &lt;U&gt;why&lt;/U&gt; these are different, I think the answer is because they were developed at different times, using different parts of Pro's underlying code, and there is no requirement that connection property information has to be returned in a single format.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 22:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/workspace-describe-connectionproperties-vs-layer/m-p/1198314#M65112</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2022-08-01T22:28:55Z</dc:date>
    </item>
  </channel>
</rss>

