Field Meta

This module defines the structure of meta-data that describes the field name, field type, special field attribute, etc. for a field in a dataset.

class, type, special)

This class acts as a container of meta-data for a single field (column) of a dataset. Each instance of this class has name, type, and special properties.


  1. Access a sub-element from an instance of FieldMetaInfo:

    • metainfo.type
    • metainfo.special
  2. Create a single element of FieldMetaInfo from a tuple of name, type, and special:

    e = ('pounds', FieldMetaType.float, FieldMetaSpecial.none)
    m = FieldMetaInfo.createFromFileFieldElement(e)
  • name (str) – field name
  • type (str) – one of the values from FieldMetaType
  • special (str) – one of the values from FieldMetaSpecial

ValueError – if type or special arg values are invalid

static createFromFileFieldElement(fieldInfoTuple)

Creates a fieldmeta.FieldMetaInfo instance from a tuple containing name, type, and special.

Parameters:fieldInfoTuple – Must contain name, type, and special
Returns:FieldMetaInfo instance
classmethod createListFromFileFieldList(fields)

Creates a FieldMetaInfo list from the a list of tuples. Basically runs createFromFileFieldElement() on each tuple.


# Create a list of FieldMetaInfo instances from a list of File meta-data
# tuples
el = [("pounds", FieldMetaType.float, FieldMetaSpecial.none),
      ("price", FieldMetaType.float, FieldMetaSpecial.none),
      ("id", FieldMetaType.string, FieldMetaSpecial.sequence),
      ("date", FieldMetaType.datetime, FieldMetaSpecial.timestamp),
ml = FieldMetaInfo.createListFromFileFieldList(el)
Parameters:fields – a sequence of field attribute tuples conforming to the format of name, type, and special
Returns:A list of FieldMetaInfo elements corresponding to the given ‘fields’ list.

Public values for the field data types. Valid types are:

  • string
  • datetime
  • int
  • float
  • bool
  • list
  • sdr
classmethod isValid(fieldDataType)

Check a candidate value whether it’s one of the valid field data types

Parameters:fieldDataType – (string) candidate field data type
Returns:True if the candidate value is a legitimate field data type value; False if not

Public values for the “special” field attribute. Valid values are:

  • R: reset
  • S: sequence
  • T: timestamp
  • C: category
  • L: learning
classmethod isValid(attr)

Check a candidate value whether it’s one of the valid attributes

Parameters:attr – (string) candidate value
Returns:True if the candidate value is a legitimate “special” field attribute; False if not