<?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 Re: Database connections in arcgispro-py3 in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835992#M4469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you find the true path for the database connection?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pro Projects are usually stored here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\Users\XXX\Documents\ArcGIS\Projects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open one of the project folder to see the .sde file. Hold down the shift button on they keyboard, right click the .sde file and copy it's path to add in the python script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2018 16:53:56 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2018-03-13T16:53:56Z</dc:date>
    <item>
      <title>Database connections in arcgispro-py3</title>
      <link>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835991#M4468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;Since Pro stores database connections in a project, how do we connect to a database from within a standalone python script?&amp;nbsp;&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;For example below is how I would have previously connected in ArcGIS 10.5&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;import arcpy&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;GDB_directory = r"C:\Python Testing"&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;targetEntGDB = r"Database Connections/espr1sql14.sde/"&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;extractedGDB ="600150be54a84779a461d4fc37247f91.gdb"&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;extractedGDB = GDB_directory + "\" +extractedGDB&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;arcpy.Copy_management(extractedGDB, targetEntGDB)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 16:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835991#M4468</guid>
      <dc:creator>JohnBroecher</dc:creator>
      <dc:date>2018-03-13T16:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Database connections in arcgispro-py3</title>
      <link>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835992#M4469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you find the true path for the database connection?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pro Projects are usually stored here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\Users\XXX\Documents\ArcGIS\Projects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open one of the project folder to see the .sde file. Hold down the shift button on they keyboard, right click the .sde file and copy it's path to add in the python script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 16:53:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835992#M4469</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2018-03-13T16:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Database connections in arcgispro-py3</title>
      <link>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835993#M4470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In ArcGIS Desktop/ArcMap, "Database Connections" is an application alias for the ArcCatalog folder in a users roaming application data directory.&amp;nbsp; I say it is an application alias because only the application and its tools are aware of it.&amp;nbsp; Although ArcGIS Pro still has roaming application data directories for users, database connection files are not stored their unless they have been marked as "Favorites," and even then it is a copy at a point in time of the original file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although "Database Connections" worked in ArcMap, I would argue the best practice is to give a fully-qualified path to the database connection file and not rely on a user-specific, application-level alias.&amp;nbsp; If you are using fully-qualified paths, the tools will work the same between ArcMap and ArcGIS Pro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to access a database connection file that is part of a project, the database connection files are stored in the project's "home folder" which can be accessed via the &lt;SPAN style="font-family: courier\ new, courier, monospace;"&gt;homeFolder&lt;/SPAN&gt; property of an ArcPy Mapping project:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os

aprx_file &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# path to aprx file&lt;/SPAN&gt;
GDB_directory &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Python Testing"&lt;/SPAN&gt;

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;aprx_file&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
targetEntGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;homeFolder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"espr1sql14.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
extractedGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"600150be54a84779a461d4fc37247f91.gdb"&lt;/SPAN&gt;
extractedGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;GDB_directory&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; extractedGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Copy_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;extractedGDB&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; targetEntGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;:&amp;nbsp; You really want to use &lt;SPAN style="font-family: courier\ new, courier, monospace;"&gt;os.path.join&lt;/SPAN&gt; to build paths.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:09:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/database-connections-in-arcgispro-py3/m-p/835993#M4470</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T10:09:02Z</dc:date>
    </item>
  </channel>
</rss>

