Type Converter

On this Page

Overview

This is a Transform type Snap that is used to detect and convert the data type of the incoming documents. It has the ability to automatically derive the type of each value. You can also specify your preference for handling certain fields in the input document. 

Input and Output

Expected input: A document input. Data types in the sub-levels in a nested JSON may not be detected.

Expected output: A document output where the data types have been converted based on the Snap's settings.

Expected upstream Snaps: Any Snap that provides a document stream output. For example, Mapper, or a combination of File Reader and JSON Parser.

Expected downstream Snaps: Any Snap that accepts a document input. For example, Profile, Mapper, or a combination of JSON Formatter and File Writer.

Prerequisites

None

Configuring Accounts

Accounts are not used with this Snap.

Configuring Views

Input

This Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view.

Troubleshooting

None

Limitations and Known Issues

None

Modes


Snap Settings


LabelRequired. The name for the Snap. Modify this to be more specific, especially if there are more than one of the same Snap in the Pipeline.
Auto

Select this checkbox to allow the Snap detect the data types automatically. 

Default value: Selected

Fail safe upon execution

Select this checkbox to allow the Snap to ignore the invalid data types and convert the remaining fields containing valid data types.

If you deselect this checkbox, the Snap fails if there are any field with invalid data types.

Default ValueDeselected

Policy

Specify your preferences about data types of fields if the auto-mode does not work as expected.

Field

The field that the type has to be converted. This is a suggestible property and suggests all fields in the dataset.

Default value: None

Type

The type of transformation to be performed on the selected column. Four options are available: 

  • Integer
  • Decimal
  • String
  • Date Time

Default value: String

Format

Only applicable for date time type, specify the format. See Simple Date Format for details and Date Functions and Properties for expression examples. 

Default value: None

Exampleyyyy-MM-dd'T'HH:mm:ss.SSS'Z'

Snap Execution

Select one of the three modes in which the Snap executes. Available options are:

Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

Disabled: Disables the Snap and all Snaps that are downstream from it.

Default Value: Validate & Execute

Example: Execute Only

Snap Execution

Select one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.


Example


Automatic Type Conversion

In this example, the input dataset's data types are automatically converted to their correct data types based on their value.

Download this pipeline.

 Understanding the pipeline

The input is a CSV document generated by the CSV Generator Snap. This document contains fields of various data types. Below is a preview of this document:

The Copy Snap is used to create two streams of this document. One stream goes into the Type Converter Snap and the other goes into the Type Inspector Snap. The Type Inspector is not necessarily required in this case but it is used to identify the fields in the document that have the wrong data type. Below is a preview of the output from the Type Inspector Snap:

The field $Deadline has the wrong data type. To correct this the Type Converter Snap is to be used.

Generally, the $ID field is supposed to be integer data type, but in this case since it is a categorical field it should be string data type. This is why the Type Converter Snap is configured to let the $ID field remain a string. The data type of the fields not listed in the Policy properties is automatically converted based on its value.

The Type Converter Snap is configured as shown below:

Based on its configuration, the Snap detects and converts data types. Below is a preview of the output from the Type Converter Snap:

A Type Inspector Snap is used downstream to demonstrate that the data type has indeed been converted by the Type Converter Snap. Below is a preview of the output from the Type Inspector Snap:


Download this pipeline.


Downloads

Important steps to successfully reuse Pipelines

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.

  File Modified

File Type_Converter_Auto.slp

Nov 21, 2018 by Mohammed Iqbal

Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
February 2024main25112 StableUpdated and certified against the current SnapLogic Platform release.
November 2023main23721Nov 8, 2023StableUpdated and certified against the current SnapLogic Platform release.

August 2023

main22460

Aug 16, 2023

Stable

Updated and certified against the current SnapLogic Platform release.

May 2023433patches21572 Latest

The Deduplicate Snap now manages memory efficiently and eliminates out-of-memory crashes using the following fields:

  • Minimum memory (MB)

  • Minimum free disk space (MB)

May 2023433patches21247 Latest

Fixed an issue with the Match Snap where a null pointer exception was thrown when the second input view had fewer records than the first.

May 2023

main21015 

Stable

Upgraded with the latest SnapLogic Platform release.

February 2023main19844 StableUpgraded with the latest SnapLogic Platform release.
December 2022431patches19268 Latest

The Deduplicate Snap now ignores fields with empty strings and whitespaces as no data.

November 2022main18944
 
Stable

Upgraded with the latest SnapLogic Platform release.

August 2022main17386
 
Stable

Upgraded with the latest SnapLogic Platform release.

4.29main15993
 
StableUpgraded with the latest SnapLogic Platform release.
4.28main14627
 
Stable

Enhanced the Type Converter Snap with the Fail safe upon execution checkbox. Select this checkbox to enable the Snap to convert data with valid data types, while ignoring invalid data types.

4.27427patches13730

Enhanced the Type Converter Snap with the Fail safe upon execution checkbox. Select this checkbox to enable the Snap to ignore invalid data types and convert data with valid data types.

4.27427patches13948
 
Latest

Fixed an issue with the Principal Component Analysis Snap, where a deadlock occurred when data is loaded from both the input views.

4.27main12833
 
StableUpgraded with the latest SnapLogic Platform release.
4.26main11181
 
StableUpgraded with the latest SnapLogic Platform release.
4.25425patches10994
 

Fixed an issue when the Deduplicate Snap where the Snap breaks when running on a locale that does not format decimals with Period (.) character. 

4.25main9554
 
StableUpgraded with the latest SnapLogic Platform release.
4.24main8556
 
StableUpgraded with the latest SnapLogic Platform release.
4.23main7430
 
StableUpgraded with the latest SnapLogic Platform release.
4.22main6403
 
StableUpgraded with the latest SnapLogic Platform release.
4.21snapsmrc542
 
Stable
  • Introduces the Mask Snap that enables you to hide sensitive information in your dataset before exporting the dataset for analytics or writing the dataset to a target file.
  • Enhances the Match Snap to add a new field, Match all, which matches one record from the first input with multiple records in the second input. Also, enhances the Comparator field in the Snap by adding one more option, Exact, which identifies and classifies a match as either an exact match or not a match at all.
  • Enhances the Deduplicate Snap to add a new field, Group ID, which includes the Group ID for each record in the output. Also, enhances the Comparator field in the Snap by adding one more option, Exact, which identifies and classifies a match as either an exact match or not a match at all.
  • Enhances the Sample Snap by adding a second output view which displays data that is not in the first output. Also, a new algorithm type, Linear Split, which enables you to split the dataset based on the pass-through percentage.
4.20 Patchmldatapreparation8771
 
Latest

Removes the unused jcc-optional dependency from the ML Data Preparation Snap Pack.

4.20snapsmrc535
 
StableUpgraded with the latest SnapLogic Platform release.
4.19snapsmrc528
 
Stable

New Snap: Introducing the Deduplicate Snap. Use this Snap to remove duplicate records from input documents. When you use multiple matching criteria to deduplicate your data, it is evaluated using each criterion separately, and then aggregated to give the final result.

4.18snapsmrc523
 
StableUpgraded with the latest SnapLogic Platform release.
4.17 PatchALL7402
 
Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515
 
Latest
  • New Snap: Introducing the Feature Synthesis Snap, which automatically creates features out of multiple datasets that share a one-to-one or one-to-many relationship with each other.
  • New Snap: Introducing the Match Snap, which enables you to automatically identify matched records across datasets that do not have a common key field.
  • Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.
4.16snapsmrc508
 
Stable

Added a new Snap, Principal Component Analysis, which enables you to perform principal component analysis (PCA) on numeric fields (columns) to reduce dimensions of the dataset.

4.15snapsmrc500
 
Stable
  • New Snap Pack. Perform preparatory operations on datasets such as data type transformation, data cleanup, sampling, shuffling, and scaling. Snaps in this Snap Pack are: 
    • Categorical to Numeric
    • Clean Missing Values
    • Date Time Extractor
    • Numeric to Categorical
    • Sample
    • Scale
    • Shuffle
    • Type Converter