blpapi.SchemaTypeDefinition

class blpapi.SchemaTypeDefinition(handle, sessions)

Representation of a “type” that can be used within a schema.

This class implements a representation of a “type” that can be used within a schema, including both plain types (integers, dates, strings, etc.) and “complex” types. The latter may be a “sequence” or a “choice” allowing either all or one of the named elements respectively. Those elements in turn are each described by a type. In addition to accessors for the type’s structure, this class also offers access to metadata providing a description and deprecation status for the type.

Each SchemaElementDefinition object is associated with a single SchemaTypeDefinition; one SchemaTypeDefinition may be used by zero, one, or many SchemaElementDefinition objects.

SchemaTypeDefinition objects are read-only.

Application clients need never create SchemaTypeDefinition objects directly; applications will typically work with objects returned by other blpapi components.

datatype()
Return type

int

Returns

The data type of this SchemaTypeDefinition.

The possible return values are enumerated in DataType.

description()
Return type

str

Returns

Human readable description of this SchemaTypeDefinition.

elementDefinitions()
Return type

Iterator[SchemaElementDefinition]

Returns

Iterator over SchemaElementDefinitions defined by this SchemaTypeDefinition.

enumeration()
Returns

All possible values of the enumeration defined by this type. None in case this SchemaTypeDefinition is not a enumeration.

getElementDefinition(nameOrIndex)
Parameters

nameOrIndex (Union[Name, int]) – Name or index of the element

Return type

SchemaElementDefinition

Returns

The definition of a specified element.

Raises

Note

Please use Name over str where possible for nameOrIndex. Name objects should be initialized once and then reused in order to minimize lookup cost.

hasElementDefinition(name)
Parameters

name (Name) – Item identifier

Return type

bool

Returns

True if this object contains an item with the specified name, False otherwise

Raises

Exception – If name is neither a Name nor a string.

Note

Please use Name over str where possible for name. Name objects should be initialized once and then reused in order to minimize lookup cost.

isComplexType()
Return type

bool

Returns

True if this SchemaTypeDefinition represents a sequence or choice type.

isEnumerationType()
Return type

bool

Returns

True if this SchemaTypeDefinition represents an enumeration type, False otherwise.

isSimpleType()
Return type

bool

Returns

True if this SchemaTypeDefinition represents neither a sequence nor a choice type.

name()
Return type

Name

Returns

The name of this SchemaTypeDefinition.

numElementDefinitions()
Return type

int

Returns

The number of SchemaElementDefinition objects.

If this SchemaTypeDefinition is neither a choice nor a sequence this will return 0.

status()
Return type

int

Returns

The deprecation status of this SchemaTypeDefinition.

The possible return values are enumerated in SchemaStatus.

toString(level=0, spacesPerLevel=4)
Parameters
  • level (int) – Indentation level

  • spacesPerLevel (int) – Number of spaces per indentation level for this and all nested objects

Return type

str

Returns

This object formatted as a string

If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level).