PyTables User's Guide: Hierarchical datasets in Python - Release 1.3.3
Prev | Chapter 4. Library Reference | Next

# 4.8. The Description class

The instances of the `Description` class provide a description of the structure of a table.

An instance of this class is automatically bound to `Table` (see 4.6) objects when they are created. It provides a browseable representation of the structure of the table, made of non-nested (`Col` —see 4.16.2) and nested (`Description`) columns. It also contains information that will allow you to build `NestedRecArray` (see appendix B) objects suited for the different columns in a table (be they nested or not).

Column descriptions (see `Col` class in 4.16.2) under a description can be accessed as attributes of it. For instance, if `table.description` is a `Description` instance with a column named `col1` under it, the later can be accessed as `table.description.col1`. If `col1` is nested and contains a `col2` column, this can be accessed as `table.description.col1.col2`.

## 4.8.1. Description instance variables

_v_name

  The name of this description instance. If description is the root of the nested type (or the description of a flat table), its name will be the empty string (`''`).

_v_names

  A list of the names of the columns hanging directly from this description instance. The order of the names matches the order of their respective columns in the containing description.

_v_pathnames

  A list of the pathnames of the columns hanging directly from this description. If the table does not contain nested columns, this is exactly the same as `_v_names` attribute.

_v_nestedNames

  A nested list of the names of all the columns hanging directly from this description instance. You can use this for the `names` argument of `NestedRecArray` factory functions.

_v_nestedFormats

  A nested list of the numarray string formats (and shapes) of all the columns hanging directly from this description instance. You can use this for the `formats` argument of `NestedRecArray` factory functions.

_v_nestedDescr

  A nested list of pairs of `(name, format)` tuples for all the columns under this table or nested column. You can use this for the `descr` argument of `NestedRecArray` factory functions.

_v_types

  A dictionary mapping the names of non-nested columns hanging directly from this description instance to their respective numarray types.

_v_stypes

  A dictionary mapping the names of non-nested columns hanging directly from this description instance to their respective string types.

_v_shapes

  A dictionary mapping the names of non-nested columns hanging directly from this description instance to their respective shapes.

_v_dflts

  A dictionary mapping the names of non-nested columns hanging directly from this description instance to their respective default values. Please, note that all the default values are kept internally as numarray objects.

_v_colObjects

  A dictionary mapping the names of the columns hanging directly from this description instance to their respective descriptions (`Col` —see 4.16.2— or `Description` —see 4.8— instances).

_v_itemsizes

  A dictionary mapping the names of non-nested columns hanging directly from this description instance to their respective item size (in bytes).

_v_nestedlvl

  The level of the description in the nested datatype.

## 4.8.2. Description methods

_v_walk(type='All')

  Iterate over nested columns.

  If `type` is `'All'` (the default), all column description objects (`Col` and `Description` instances) are returned in top-to-bottom order (pre-order).

  If `type` is `'Col'` or `'Description'`, only column descriptions of that type are returned.

Prev | Home | Next
The Cols class | Up | The Column class