Skip to main content

RecordInfo for Python Engine SDK

Important

This Python SDK uses outdated technology that limits your extension opportunities. We've built a new Platform SDK using Python and the latest open-source technology to deliver a vastly improved development experience. Go to Platform SDK to get started!

The RecordInfo class provides a system for identifying and manipulating information within a record. RecordRef represents a reference to a record’s underlying data, and can be accessed & manipulated via the RecordInfo class.

Record Information

num_fields: The number of fields in the record.

Methods

_init_

Instantiates a new instance of the RecordInfo class.

__init__((int)max_field_length, (bool)strict_naming,
    (AlteryxEngine)alteryx_engine) -> None :
__init__((AlteryxEngine)alteryx_engine) -> None :
  • max_field_length: The maximum field length in bytes.

  • strict_naming: An option to limit field names to only contain alpha-numeric characters.

  • alteryx_engine: The Alteryx Engine to use with this RecordInfo.

Test Method

Allows tests to construct a new instance of the RecordInfo class without an engine.

__init__((int)ignored_int) -> None :

add_field

Adds a field to the record.

add_field((str)field_name, (FieldType)field_type, (int)size=0,
     (int)scale=0, (str)source='', (str)description='') -> Field :
add_field((Field)field) -> Field :

Returns the generated Field. Use the return value to access the new field.

Returned Field Names

This method may change the name of your field to prevent conflicts. You should capture the return value rather than subsequently searching for this field by name.

  • field_name: The name of the new field.

  • field_type: The type of the new field.

  • size: An option to set the number of characters for strings or the size in bytes for blob or spatial types. This option is ignored for primitive types.

  • scale An option to set the scaling factor for fixed decimals. This option is ignored for all other data types.

  • source: The source string in the field metadata.

  • description: The description string in the field metadata.

  • field object: The object to be added to the record.

add_field_from_xml

Adds a field to the record.

add_field_from_xml((str)xml, (str)name_prefix='') -> Field :

Returns the Field object with the added record.

  • xml: The XML element that describes the field definition.

  • name_prefix: An optional prefix to append to the field names.

clone

clone() -> RecordInfo :

Returns a new RecordInfo object that is identical to current object.

construct_record_creator

construct_record_creator() -> RecordCreator :

Returns a new, empty RecordCreator based upon the current record layout.

equal_types

equal_types((RecordInfo)record_info, 
    (bool)allow_additional_fields=False) -> bool :

Returns True if the record layouts are the same, disregarding field names; otherwise, returns False.

  • record_info: The RecordInfo object against which this object is compared.

  • allow_additional_fields: An option to allow the method to return True if one the RecordInfo objects has fields that do not occur in the other object.

get_field_by_name

get_field_by_name((str)field_name, (bool)throw_error=True) -> object :

Returns a Field object describing the specified field; returns None if a field with that name could not be found.

  • field_name: The name of the field to retrieve.

  • throw_error: An option to generate an exception if there is no field with the specified name.

get_field_num

get_field_num((str)field_name, (bool)throw_error=True) -> int :

Returns the zero-based index for the field with the specified name, or -1 if a field with that name could not be found.

  • field_name: The name of the field to retrieve.

  • throw_error: An option to generate an exception if there is no field with the specified name.

get_hash

get_hash() -> int :

Returns the hash code for the RecordInfo. If two RecordInfo objects have the same hashcode, they should be binary compatible.

get_record_xml_meta_data

Returns the XML description of the record layout.

get_record_xml_meta_data((bool)include_source=True) -> str :

include_source: An option to include this field's Source value in the XML.

init_from_xml

Initializes the record layout based upon the supplied XML description.

init_from_xml((str)xml, (str)name_prefix='') -> None :
  • xml: The XML element that describes the record layout.

  • name_prefix: An optional prefix to append to the field names.

rename_field_by_index

Renames the specified field.

rename_field_by_index((int)field_idx, (str)new_name) -> Field :
  • field_idx: The zero-based index of the field to be renamed.

  • new_name: The new name for the field.

rename_field_by_name

Renames the specified field.

rename_field_by_name((str)old_name, (str)new_name) -> Field :
  • old_field: The name of the field to be renamed.

  • new_name: The new name for the field.

swap_field_name

Swaps the names of two fields.

swap_field_names((int)field_1, (int)field_2) -> None :