2

In the documentation for the GDAL/OGR OpenFileGDB driver, there is a Dataset open option called LIST_ALL_TABLES. Using python, how exactly do I set that?

2 Answers 2

2

You can find an example from the GDAL Python tests https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_openfilegdb.py#L2115

 # Test LIST_ALL_TABLES=YES open option
    ds_all_table = gdal.OpenEx(
        "data/filegdb/testopenfilegdb.gdb.zip",
        gdal.OF_VECTOR,
        open_options=["LIST_ALL_TABLES=YES"],
    )
1
  • 1
    Yes! that does it! Thank you. Although it may be worth noting that when using gdal.OpenEx, you can't use for layer in ds: like you can when you use ogr.Open(). But right below that snippet at the github page is the iteration layer_names = [ds_all_table.GetLayer(i).GetName() for i in range(ds_all_table.GetLayerCount())]
    – EvanT
    Mar 26 at 20:02
2

For information, this is also possible using fiona, a library that offers alternative, more "pythonic", bindings to GDAL:

tables = fiona.listlayers(
    "data/filegdb/testopenfilegdb.gdb.zip", list_all_tables="YES"
)
1
  • 1
    I wish I could use Fiona! For now I am constrained to the packages that are in the default ArcGIS Pro environment which does not include Fiona and has only a part of the full GDAL library. I want to make my tool usable to other Pro users without the hurdle of cloning the default env and adding packages.
    – EvanT
    Mar 27 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.