MSCEWI2074

Period types are handled as two data fields

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Low

Description

Teradata has a period data type used to represent a time interval, with instances of this type having a beginning and ending bound of the same type (time, date or timestamp) along with a set of functions that allow to initialize and manipulate period data like PERIOD, BEGIN, END, OVERLAPS, etc.

Since the period type is not supported by Snowflake, SnowConvert transforms this type and its related functions using the following rules:

  • Any period type declaration in column tables is migrated as a two column of the same type.

  • The period value constructor function is migrated into two different constructors of the period subtype one with the begin value and the other with the end value.

  • Supported functions that expect period type parameters are migrated to UDFs as well, these UDFs expect almost two parameters for the begin value and the end value.

Example code

Input code:

CREATE TABLE DateTable
(
	COL1 PERIOD(DATE) DEFAULT PERIOD (DATE '2005-02-03', UNTIL_CHANGED)
);

Output code:

CREATE TABLE PUBLIC.DateTable
(
	COL1_begin DATE DEFAULT DATE '2005-02-03',
	COL1_end DATE DEFAULT DATE '9999-12-31' /*** MSC-WARNING - MSCEWI2074 - PERIOD DATA TYPES ARE HANDLED AS TWO DATA FIELDS ***/
);

Recommendations

Last updated