<?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: Is it Possible to Set a Default GDB via Arcpy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1265012#M66996</link>
    <description>&lt;P&gt;There is updateFolderConnections in arcpy's mapping class, but it doesn't look like you can simply add a folder you have to replace the existing connections dictionary with a replacement&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;scroll wayyyyy down.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Mar 2023 17:10:09 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2023-03-07T17:10:09Z</dc:date>
    <item>
      <title>Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264772#M66988</link>
      <description>&lt;P&gt;I have tried to write a script to save a copy of a aprx, while changing the default gdb, using the documentation I found at the link below.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aprx.defaultGeodatabase = ....&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;However, this doesn't actually work and the resulting aprx just has the same default gdb as the original aprx I have open. Is there something I'm missing?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os
from arcpy import env
proj_folder = arcpy.GetParameterAsText(0)
outfolder = arcpy.GetParameterAsText(1)
aprx_name = arcpy.GetParameterAsText(2)
aprx = arcpy.mp.ArcGISProject("CURRENT")
new_gdb = proj_folder + "\\Data\\ProjComp\\ProjComp.gdb"
aprx.defaultGeodatabase = new_gdb
aprx.saveACopy(outfolder+"\\"+aprx_name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 01:01:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264772#M66988</guid>
      <dc:creator>rescobar</dc:creator>
      <dc:date>2023-03-07T01:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264813#M66989</link>
      <description>&lt;P&gt;There was a cavaet in the link&lt;/P&gt;&lt;P&gt;defaultGeodatabase&lt;BR /&gt;(Read and Write)&lt;BR /&gt;The project's default geodatabase location. The string must include the geodatabase's full path and file name. Note: this property can be set as read-only by an Administrator and therefore it can't be modified.&lt;/P&gt;&lt;P&gt;String&lt;/P&gt;&lt;P&gt;ArcGISProject example 1 shows basically what you have done above, but I wonder if you have to make outfolder and proj_folder the same so that the aprx and gdb are in the same relative positions as the "CURRENT" project&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 03:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264813#M66989</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-07T03:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264860#M66991</link>
      <description>&lt;P&gt;I have had the same experience. The default geodatabase can be set/defined but once you open the aprx you need to add the geodatabase as a database connection. It will then show as the default geodatabase. This is the only workaround I presently am familiar with.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 10:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264860#M66991</guid>
      <dc:creator>ChristopherRoss8</dc:creator>
      <dc:date>2023-03-07T10:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264986#M66994</link>
      <description>&lt;P&gt;Thanks, I take it there's no way to add a database connection in arcpy then?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 16:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264986#M66994</guid>
      <dc:creator>rescobar</dc:creator>
      <dc:date>2023-03-07T16:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264993#M66995</link>
      <description>&lt;P&gt;Not that I am aware of.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 16:52:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1264993#M66995</guid>
      <dc:creator>ChristopherRoss8</dc:creator>
      <dc:date>2023-03-07T16:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1265012#M66996</link>
      <description>&lt;P&gt;There is updateFolderConnections in arcpy's mapping class, but it doesn't look like you can simply add a folder you have to replace the existing connections dictionary with a replacement&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;scroll wayyyyy down.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 17:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1265012#M66996</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-07T17:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Possible to Set a Default GDB via Arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1265133#M67004</link>
      <description>&lt;P&gt;Thanks, it seems like this yields the same results&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 20:02:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-set-a-default-gdb-via-arcpy/m-p/1265133#M67004</guid>
      <dc:creator>rescobar</dc:creator>
      <dc:date>2023-03-07T20:02:10Z</dc:date>
    </item>
  </channel>
</rss>

