PySpark extension types
The types that are used by the AWS Glue PySpark extensions.
DataType
The base class for the other AWS Glue types.
__init__(properties={})
-
propertiesβ Properties of the data type (optional).
β―
typeName(cls)
Returns the type of the AWS Glue type class (that is, the class name with "Type" removed from the end).
-
clsβ An AWS Glue class instance derived fromDataType.
β―
jsonValue( )
Returns a JSON object that contains the data type and properties of the class:
{ "dataType": typeName, "properties": properties }
AtomicType and simple derivatives
Inherits from and extends the DataType class, and serves as the base class for all the AWS Glue atomic data types.
fromJsonValue(cls, json_value)
Initializes a class instance with values from a JSON object.
-
clsβ An AWS Glue type class instance to initialize. -
json_valueβ The JSON object to load key-value pairs from.
β―
The following types are simple derivatives of the AtomicType class:
BinaryTypeβ Binary data.BooleanTypeβ Boolean values.ByteTypeβ A byte value.DateTypeβ A datetime value.DoubleTypeβ A floating-point double value.IntegerTypeβ An integer value.LongTypeβ A long integer value.NullTypeβ A null value.ShortTypeβ A short integer value.StringTypeβ A text string.TimestampTypeβ A timestamp value (typically in seconds from 1/1/1970).UnknownTypeβ A value of unidentified type.
DecimalType(AtomicType)
Inherits from and extends the AtomicType class to represent a decimal number (a number expressed in decimal digits, as opposed to binary base-2 numbers).
__init__(precision=10, scale=2, properties={})
-
precisionβ The number of digits in the decimal number (optional; the default is 10). -
scaleβ The number of digits to the right of the decimal point (optional; the default is 2). -
propertiesβ The properties of the decimal number (optional).
EnumType(AtomicType)
Inherits from and extends the AtomicType class to represent an enumeration of valid options.
__init__(options)
-
optionsβ A list of the options being enumerated.
Β collection types
ArrayType(DataType)
__init__(elementType=UnknownType(), properties={})
-
elementTypeβ The type of elements in the array (optional; the default is UnknownType). -
propertiesβ Properties of the array (optional).
ChoiceType(DataType)
__init__(choices=[], properties={})
-
choicesβ A list of possible choices (optional). -
propertiesβ Properties of these choices (optional).
β―
add(new_choice)
Adds a new choice to the list of possible choices.
-
new_choiceβ The choice to add to the list of possible choices.
β―
merge(new_choices)
Merges a list of new choices with the existing list of choices.
-
new_choicesβ A list of new choices to merge with existing choices.
MapType(DataType)
__init__(valueType=UnknownType, properties={})
-
valueTypeβ The type of values in the map (optional; the default is UnknownType). -
propertiesβ Properties of the map (optional).
Field(Object)
Creates a field object out of an object that derives from DataType.
__init__(name, dataType, properties={})
-
nameβ The name to be assigned to the field. -
dataTypeβ The object to create a field from. -
propertiesβ Properties of the field (optional).
StructType(DataType)
Defines a data structure (struct).
__init__(fields=[], properties={})
-
fieldsβ A list of the fields (of typeField) to include in the structure (optional). -
propertiesβ Properties of the structure (optional).
β―
add(field)
-
fieldβ An object of typeFieldto add to the structure.
β―
hasField(field)
Returns True if this structure has a field of the same name, or
False if not.
-
fieldβ A field name, or an object of typeFieldwhose name is used.
β―
getField(field)
-
fieldβ A field name or an object of typeFieldwhose name is used. If the structure has a field of the same name, it is returned.
EntityType(DataType)
__init__(entity, base_type, properties)
This class is not yet implemented.
Β other types
DataSource(object)
__init__(j_source, sql_ctx, name)
-
j_sourceβ The data source. -
sql_ctxβ The SQL context. -
nameβ The data-source name.
β―
setFormat(format, **options)
-
formatβ The format to set for the data source. -
optionsβ A collection of options to set for the data source. For more information about format options, see Data format options for inputs and outputs in AWS Glue for Spark.
β―
getFrame()
Returns a DynamicFrame for the data source.
DataSink(object)
__init__(j_sink, sql_ctx)
-
j_sinkβ The sink to create. -
sql_ctxβ The SQL context for the data sink.
β―
setFormat(format, **options)
-
formatβ The format to set for the data sink. -
optionsβ A collection of options to set for the data sink. For more information about format options, see Data format options for inputs and outputs in AWS Glue for Spark.
β―
setAccumulableSize(size)
-
sizeβ The accumulable size to set, in bytes.
β―
writeFrame(dynamic_frame, info="")
-
dynamic_frameβ TheDynamicFrameto write. -
infoβ Information about theDynamicFrame(optional).
β―
write(dynamic_frame_or_dfc, info="")
Writes a DynamicFrame or a DynamicFrameCollection.
-
dynamic_frame_or_dfcβ Either aDynamicFrameobject or aDynamicFrameCollectionobject to be written. -
infoβ Information about theDynamicFrameorDynamicFramesto be written (optional).