<?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: Using Python to Rebuild Indexes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1379693#M69809</link>
    <description>&lt;P&gt;The error is because the result of&amp;nbsp;ListTables is empty/null.&amp;nbsp;Try setting the environment workspace as shown on the first line of the example in &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/using-python-scripting-to-batch-reconcile-and-post-versions.htm#ESRI_SECTION1_CAC3CB09C4584334BA3A4E4705439626" target="_self"&gt;the docs&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# set the workspace 
arcpy.env.workspace = r"A:\File\Path\dataowner.sde"

# Set a variable for the workspace
workspace = arcpy.env.workspace

userName = arcpy.Describe(workspace).connectionProperties.user

dataList = arcpy.ListTables(userName + '.*') + arcpy.ListFeatureClasses(userName + '.*') + arcpy.ListRasters(userName + '.*')

for dataset in arcpy.ListDatasets(userName + '.*'):
    dataList += arcpy.ListFeatureClasses(feature_dataset=dataset)

arcpy.RebuildIndexes_management(workspace, "NO_SYSTEM", dataList, "ALL")
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", dataList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 15:17:50 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2024-02-08T15:17:50Z</dc:date>
    <item>
      <title>Using Python to Rebuild Indexes</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1379639#M69807</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I am attempting to create a script that rebuilds indexes and updates statistics on tables on a regular schedule. I am using an Oracle enterprise geodatabase.&lt;/P&gt;&lt;P&gt;I am using this post from Esri to try and recreate my script (see the &lt;EM&gt;Rebuild indexes and update statistics&lt;/EM&gt; section):&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/using-python-scripting-to-batch-reconcile-and-post-versions.htm" target="_self"&gt;Using Python scripting to batch reconcile and post traditional versions&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try and run my code (below), I get this error which is noting the dataList variable as the problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;workspace = r"A:\File\Path\dataowner.sde"
userName = arcpy.Describe(workspace).connectionProperties.user

dataList = arcpy.ListTables(userName + '.*') + arcpy.ListFeatureClasses(userName + '.*') + arcpy.ListRasters(userName + '.*')

for dataset in arcpy.ListDatasets(userName + '.*'):
    dataList += arcpy.ListFeatureClasses(feature_dataset=dataset)

arcpy.RebuildIndexes_management(workspace, "NO_SYSTEM", dataList, "ALL")
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", dataList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks - Josh&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 13:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1379639#M69807</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2024-02-08T13:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Rebuild Indexes</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1379693#M69809</link>
      <description>&lt;P&gt;The error is because the result of&amp;nbsp;ListTables is empty/null.&amp;nbsp;Try setting the environment workspace as shown on the first line of the example in &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/using-python-scripting-to-batch-reconcile-and-post-versions.htm#ESRI_SECTION1_CAC3CB09C4584334BA3A4E4705439626" target="_self"&gt;the docs&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# set the workspace 
arcpy.env.workspace = r"A:\File\Path\dataowner.sde"

# Set a variable for the workspace
workspace = arcpy.env.workspace

userName = arcpy.Describe(workspace).connectionProperties.user

dataList = arcpy.ListTables(userName + '.*') + arcpy.ListFeatureClasses(userName + '.*') + arcpy.ListRasters(userName + '.*')

for dataset in arcpy.ListDatasets(userName + '.*'):
    dataList += arcpy.ListFeatureClasses(feature_dataset=dataset)

arcpy.RebuildIndexes_management(workspace, "NO_SYSTEM", dataList, "ALL")
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", dataList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 15:17:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1379693#M69809</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-02-08T15:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Rebuild Indexes</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1380043#M69818</link>
      <description>&lt;P&gt;I completely overlooked that. Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 21:41:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-rebuild-indexes/m-p/1380043#M69818</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2024-02-08T21:41:04Z</dc:date>
    </item>
  </channel>
</rss>

