Skip to main content

Fixed-width

Read a fixed-width file from an external connection using a Source gem.

info

Writing fixed-width files using a Target gem is not supported.

Supported connections

You can read fixed-width files from the following connections:

Configuration tabs

When you create a new Source gem, the gem dialog contains the following tabs.

  • Type: Choose the file storage provider you will connect to.
  • Source/Target location: Choose the connection and define the file path where you will read from.
  • Properties: Infer or manually specify the schema, and optionally add properties that influence table behavior.
  • Preview: Load a preview of the dataset reflecting your configurations.

Parameters

Configure a Source gem using the following parameters to read a fixed-width file.

ParameterTabDescription
Connection typeTypeLocation you want to connect from.
Format typeSource locationFormat of the gem. In this case, fixedwidth.
Select or create connectionSource locationWhether to select an existing connection, or to create a new one.
FilepathSource locationFile path where you want to read and write files according to the connection type.
PropertiesPropertiesOptional table properties to apply. Source properties are outlined below.
SchemaPropertiesSchema definition of the table (custom schema only).

Source schema

Define the schema of your dataset in the Properties tab of the gem. This determines the structure of your dataset.

info

You must define the schema manually for fixed-width files. Schema inference isn't supported.

Each row in the Schema table corresponds to a fixed-width column in the file and includes the following attributes:

FieldDescription
NameName of the column.
TypeType of data in the column.
OffsetStarting character position in the row for this column.
LengthNumber of characters for this column.
MetadataAdditional information about the column. Some data types require certain metadata fields.

Metadata fields

Hover over a row in the Schema table to reveal a dropdown arrow next to the Metadata field. Use this dropdown to add column details, such as a description or tags. Metadata is optional for the majority of data types but is sometimes required.

The tables below list metadata fields specific to certain data types per SQL warehouse provider:

Data typeSpecific metadata fieldsRequired
ArrayNumber of occurrences: Number of elements in the array.Yes
DecimalScale: Number of digits after the decimal point.No
DateFormat: Expected format of the date that can override the global default at the column level.No
TimeFormat: Expected format of the time that can override the global default at the column level.No
TimestampFormat: Expected format of the timestamp that can override the global default at the column level.No
note

For a complete list of supported data types, visit Supported data types.

Source properties

The following properties are available to customize how how fixed-width files are read.

PropertyDescriptionDefault
DescriptionDescription of the table.None
Line DelimitedWhether each record ends with a newline character.Disabled
Strip Trailing BlanksStrip trailing whitespace from string values when reading the data.Disabled
Number of Initial Rows to SkipNumber of lines to skip before the data begins, usually 1 for the header row.0
Number of Bytes to Skip Between RowsUsually used by the Transpiler.0
Date Format ReferenceGlobal default format for parsing date columns.2006-01-02
Time Format ReferenceGlobal default format for parsing time columns.15:04:05
Timestamp Format ReferenceGlobal default format for parsing timestamp columns.2006-01-02 15:04:05
Decimal PointCharacter used as a decimal point..