<?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: List Feature Classes in Database in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-feature-classes-in-database/m-p/546692#M42662</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Heya Justin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out the code example for the Data Access Walk function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/walk.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/walk.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Walk—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will let you quickly list all your feature classes without needing separate code to peek in each feature dataset. Once you've got a nice list of all feature classes, you can identify which ones are populated with at least one feature using&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Get Count—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;. Note with Get Count that you need to access the result as an integer in your script. So use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy listing!&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 23:39:42 GMT</pubDate>
    <dc:creator>MicahBabinski</dc:creator>
    <dc:date>2021-12-11T23:39:42Z</dc:date>
    <item>
      <title>List Feature Classes in Database</title>
      <link>https://community.esri.com/t5/python-questions/list-feature-classes-in-database/m-p/546691#M42661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to create a list of features classes inside of our LGIM database for handouts to staff. &amp;nbsp;I can successfully print out a list of all of the feature classes using the code below, but I want to only list feature classes that have content in them. &amp;nbsp;Does anyone have a script they could share? Or has anyone done this before? &amp;nbsp;If it helps, the data I'm trying to access is in SDE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: blue;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;arcpy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: blue;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;os&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;env&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;workspace&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515;"&gt;"c:/base/gdb.gdb"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;datasets&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;ListDatasets&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;feature_type&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515;"&gt;'feature'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;datasets&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515;"&gt;''&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;]&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;datasets&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;datasets&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: blue;"&gt;is&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: blue;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;None&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: blue;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;[]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: blue;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;ds&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: blue;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;datasets:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; for&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;fc&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: blue;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;ListFeatureClasses&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;feature_dataset&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;ds&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; path&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;os&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;path&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;join&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;env&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;workspace&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;ds&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;fc&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;path&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 19:11:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-feature-classes-in-database/m-p/546691#M42661</guid>
      <dc:creator>JustinFuto1</dc:creator>
      <dc:date>2017-08-22T19:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: List Feature Classes in Database</title>
      <link>https://community.esri.com/t5/python-questions/list-feature-classes-in-database/m-p/546692#M42662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Heya Justin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out the code example for the Data Access Walk function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/walk.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/walk.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Walk—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will let you quickly list all your feature classes without needing separate code to peek in each feature dataset. Once you've got a nice list of all feature classes, you can identify which ones are populated with at least one feature using&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Get Count—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;. Note with Get Count that you need to access the result as an integer in your script. So use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy listing!&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:39:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-feature-classes-in-database/m-p/546692#M42662</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2021-12-11T23:39:42Z</dc:date>
    </item>
  </channel>
</rss>

