Skip to main content
replaced http://gis.stackexchange.com/ with https://gis.stackexchange.com/
Source Link

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy. (EDIT, see further below: there is possibly also a way to do it via OGR in QGIS).

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from herehere:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding thisthis and thisthis might help.


EDIT:

Trying to go with the way of ogr in qgis now. Referencing thisthis.

Still need to work out the code to do so.

enter image description here

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy. (EDIT, see further below: there is possibly also a way to do it via OGR in QGIS).

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.


EDIT:

Trying to go with the way of ogr in qgis now. Referencing this.

Still need to work out the code to do so.

enter image description here

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy. (EDIT, see further below: there is possibly also a way to do it via OGR in QGIS).

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.


EDIT:

Trying to go with the way of ogr in qgis now. Referencing this.

Still need to work out the code to do so.

enter image description here

Changed title to remove arcpy reference, added potential for using qgis
Source Link
weiji14
  • 1.8k
  • 14
  • 32

Get row counts of all tables in file geodatabase using arcpy, ideally from metadata

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy. (EDIT, see further below: there is possibly also a way to do it via OGR in QGIS).

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.


EDIT:

Trying to go with the way of ogr in qgis now. Referencing this.

Still need to work out the code to do so.

enter image description here

Get row counts of all tables in geodatabase using arcpy, ideally from metadata

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy.

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.

Get row counts of all tables in file geodatabase, ideally from metadata

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy. (EDIT, see further below: there is possibly also a way to do it via OGR in QGIS).

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.


EDIT:

Trying to go with the way of ogr in qgis now. Referencing this.

Still need to work out the code to do so.

enter image description here

Added other gis stackexchange links
Source Link
weiji14
  • 1.8k
  • 14
  • 32

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy.

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy.

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I need some help with finding a way to list all the row counts for many tables (feature classes as well as non-spatial ones) in a file geodatabase. At the moment it's done manually by viewing the description tab in ArcCatalog and copying and pasting but I think there should be a way to bring out that information using arcpy.

The file geodatabase structure is as follows:

my_geodb.gdb
        |----Feature_Dataset1
                    |----Table1
                    |----Table2
                    |----Table3
                    |----Table4
                    |...

I have gotten as far as doing this with a bit of help from here:

import arcpy
arcpy.env.workspace = my_geodb.gdb
oldws = arcpy.env.workspace               #saves this as main workspace

featureDatasets = arcpy.ListDatasets()    #lists all datasets in geodb
for fd in featureDatasets:
    arcpy.env.workspace = oldws + "\\" + fd
    featureClasses = arcpy.ListFeatureClasses()
    for fc in featureClasses:
        count = arcpy.GetCount_management(fc).getOutput(0)
    print fc, count

It's just getting the row counts from the metadata that I'm having problems with, my arcpy API knowledge is a bit inadequate for that. The above code works but it's really slow, and I was wondering how I can pull these row counts directly from the metadata since it's displayed there already in the ArcCatalog.

enter image description here

I'm finding this and this might help.

Added metadata picture
Source Link
weiji14
  • 1.8k
  • 14
  • 32
Loading
clarified that tables include spatial and non-spatial ones
Source Link
weiji14
  • 1.8k
  • 14
  • 32
Loading
Added Loop
Source Link
weiji14
  • 1.8k
  • 14
  • 32
Loading
deleted 39 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading
Source Link
weiji14
  • 1.8k
  • 14
  • 32
Loading