<?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 Python Script to Bulk Transfer Domains Between Geodatabases in ArcGIS in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581105#M92584</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Tired of transferring domains one by one using&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Domain to Table&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Table to Domain&lt;/STRONG&gt;&lt;SPAN&gt;? I created a&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Python script&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;to automate the process! This script transfers&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;all domains&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(or specific ones) between geodatabases in one go, saving time and effort. Perfect for file geodatabases, enterprise geodatabases, and ArcSDE connections.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How it works&lt;/STRONG&gt;:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Provide the source and target geodatabase paths.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Run the script.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;All domains are transferred automatically!&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Sat, 01 Feb 2025 12:20:11 GMT</pubDate>
    <dc:creator>JEMOO-01</dc:creator>
    <dc:date>2025-02-01T12:20:11Z</dc:date>
    <item>
      <title>Python Script to Bulk Transfer Domains Between Geodatabases in ArcGIS</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581105#M92584</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Tired of transferring domains one by one using&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Domain to Table&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Table to Domain&lt;/STRONG&gt;&lt;SPAN&gt;? I created a&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Python script&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;to automate the process! This script transfers&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;all domains&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(or specific ones) between geodatabases in one go, saving time and effort. Perfect for file geodatabases, enterprise geodatabases, and ArcSDE connections.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How it works&lt;/STRONG&gt;:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Provide the source and target geodatabase paths.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Run the script.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;All domains are transferred automatically!&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Sat, 01 Feb 2025 12:20:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581105#M92584</guid>
      <dc:creator>JEMOO-01</dc:creator>
      <dc:date>2025-02-01T12:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script to Bulk Transfer Domains Between Geodatabases in ArcGIS</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581165#M92591</link>
      <description>&lt;P&gt;This looks great!&amp;nbsp; I did something vaguely similar for our team that created batch procedures to convert Domains to/from Excel files, because it's much faster to reorder and change individual domain entries in Excel than it is using the built-in Domain editor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A few points on your script that I noticed while reading over it:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I notice you essentially reinvented &lt;A title="ValidateTableName" href="https://pro.arcgis.com/en/pro-app/3.3/arcpy/functions/validatetablename.htm" target="_self"&gt;arcpy.ValidateTableName&lt;/A&gt;&amp;nbsp;with your&amp;nbsp;&lt;STRONG&gt;sanitize_table_name&lt;/STRONG&gt; function.&amp;nbsp; Was that intentional, or just something you hadn't yet encountered in the endless libraries of arcpy?&lt;/LI&gt;&lt;LI&gt;Those GDB inputs at lines 14 &amp;amp; 15 would be prime candidates for tool inputs, if you wanted to make this a more user-friendly geoprocessing tool.&lt;/LI&gt;&lt;LI&gt;Line 26 is amusing to me, in that I'd often wondered if python's f-strings and raw strings could be combined like that, but I'd never actually taken the 2 seconds to test it.&amp;nbsp; Nice to finally know!&lt;/LI&gt;&lt;LI&gt;Line 50: There are arguably use-cases here for whether the user might want to append or replace domains in this procedure.&amp;nbsp; I see 2–4 approaches, with increasing complexity:&lt;OL&gt;&lt;LI&gt;An input variable similar to the GDBs on Lines 14 &amp;amp; 15 that sets either "APPEND" or "REPLACE" at a global level.&lt;/LI&gt;&lt;LI&gt;An input() command which asks the user to specify which to use for each domain as it comes up.&amp;nbsp; (&lt;STRONG&gt;N.B.&lt;/STRONG&gt; I'm fairly certain this command doesn't work in the context of geoprocessing tools, if you take the advice of Point #2)&lt;/LI&gt;&lt;LI&gt;If you go with Point #2, you could make use of the Validation section of that geoprocessing tool to pre-populate a table of inputs into the tool showing each domain found in GDB1, with the second column having a text input for "APPEND" or "REPLACE" for each entry.&amp;nbsp; I'd suggest having each domain set to "APPEND" by default, as a starting point.&lt;/LI&gt;&lt;LI&gt;This combines Approaches 2 &amp;amp; 3 with a global input variable that sets the default value in the table-of-domain-names in Approach 3, which can then be toggled individually as per Approach 3.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Line 53, Warning for ArcMap/Python 2:&lt;/STRONG&gt;&lt;/FONT&gt; This will break for ArcMap users, because the&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; character is outside the bounds of basic ascii, and Python 2 didn't use Unicode strings by default, the way Python 3 does.&lt;/LI&gt;&lt;LI&gt;You can also paste this script into the code block tool on the forums, rather than as a .txt attachment.&amp;nbsp; It's the &lt;STRONG&gt;&amp;lt;/&amp;gt;&lt;/STRONG&gt; button in the format buttons.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Sun, 02 Feb 2025 22:26:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581165#M92591</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2025-02-02T22:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script to Bulk Transfer Domains Between Geodatabases in ArcGIS</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581205#M92598</link>
      <description>&lt;P&gt;Thank you for the detailed feedback and suggestions! I really appreciate your insights. Here’s my response to your points:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.ValidateTableName&lt;/STRONG&gt;: You're absolutely right that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;arcpy.ValidateTableName&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;exists and could be used here. I wrote the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;sanitize_table_name&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function as a learning exercise and to have more control over the sanitization process (e.g., ensuring the name starts with a letter and truncating to 30 characters). However, using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;arcpy.ValidateTableName&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;would indeed make the code more concise and aligned with ArcPy's built-in functionality. I'll consider refactoring it in the next version!&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;GDB Inputs as Tool Inputs&lt;/STRONG&gt;: Great suggestion! Converting the GDB paths into tool inputs would make the script more user-friendly, especially for colleagues who might not be comfortable editing the script directly. I'll explore wrapping this script into a custom ArcGIS geoprocessing tool with input parameters for the source and target geodatabases.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Combining f-strings and Raw Strings&lt;/STRONG&gt;: Glad you found the f-string and raw string combination amusing! It’s one of those Python features that feels like a hidden gem once you realize how well they work together. I use it often for file paths to avoid escaping backslashes while still leveraging the power of f-strings.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Append vs. Replace Domains&lt;/STRONG&gt;: Thanks for the detailed suggestions on handling 'APPEND' vs. 'REPLACE'! I agree that this would add valuable flexibility. Here’s how I’m thinking of implementing it:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Add a global input variable to let users choose between 'APPEND' and 'REPLACE' for all domains.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;For more granular control, I could create a table or dictionary to specify the behavior for each domain individually.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;If I turn this into a geoprocessing tool, I’ll explore using the Validation section to pre-populate a table of domains with default options, as you suggested.&lt;BR /&gt;I’ll start with the global input variable and work my way up to the more advanced options.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Unicode Character Compatibility&lt;/STRONG&gt;: That’s a great catch! I didn’t consider ArcMap/Python 2 compatibility when using the &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; emoji. To ensure broader compatibility, I’ll replace it with a basic ASCII character like a checkmark (√) or simply use 'DONE' or 'SUCCESS'. Thanks for pointing that out!&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Code Formatting on Forums&lt;/STRONG&gt;: Thanks for the tip about using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;/&amp;gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to format the script on forums! I’ll make sure to do that in future posts to improve readability.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;-------------------------&lt;/P&gt;&lt;P&gt;Thank you again for your insightful feedback and for sharing that wonderful quote by Robert A. Heinlein. It’s a great reminder that while we can’t control every outcome, maintaining an optimistic outlook makes the journey more enjoyable—and often more productive! I’ll definitely keep that in mind as I continue refining this script and exploring new ways to improve it.&lt;/P&gt;&lt;P&gt;Looking forward to more discussions like this in the future!&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;JIMMY&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 08:26:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-to-bulk-transfer-domains-between/m-p/1581205#M92598</guid>
      <dc:creator>JEMOO-01</dc:creator>
      <dc:date>2025-02-03T08:26:54Z</dc:date>
    </item>
  </channel>
</rss>

