SnowConvert AI - Redshift - Data types¶
Current Data types conversion for Redshift in SnowConvert AI.
Snowflake supports most basic SQL data types (with some restrictions) for use in columns, local variables, expressions, parameters, and any other appropriate/suitable locations.
Numeric Data Types ¶
Redshift |
Snowflake |
Notes |
|---|---|---|
INT |
INT |
Snowflake’s INT is an alias for NUMBER. |
INT2 |
SMALLINT |
Snowflake’s INT2 is an alias for NUMBER. |
INT4 |
INTEGER |
Snowflake’s INT4 is an alias for NUMBER. |
INT8 |
INTEGER |
Snowflake’s INT8 is an alias for NUMBER. |
INTEGER |
INTEGER |
Snowflake’s INTEGER is an alias for NUMBER. |
BIGINT |
BIGINT |
Snowflake’s BIGINT is an alias for NUMBER. |
DECIMAL |
DECIMAL |
Snowflake’s DECIMAL is an alias for NUMBER. |
DOUBLE PRECISION |
DOUBLE PRECISION |
Snowflake’s DOUBLE PRECISION is an alias for FLOAT. |
NUMERIC |
NUMERIC |
Snowflake’s NUMERIC is an alias for NUMBER. |
SMALLINT |
SMALLINT |
Snowflake’s SMALLINT is an alias for NUMBER. |
FLOAT |
FLOAT |
Snowflake uses double-precision (64 bit) IEEE 754 floating-point numbers. |
FLOAT4 |
FLOAT4 |
Snowflake’s FLOAT4 is an alias for FLOAT. |
FLOAT8 |
FLOAT8 |
Snowflake’s FLOAT8 is an alias for FLOAT. |
REAL |
REAL |
Snowflake’s REAL is an alias for FLOAT. |
Character Types ¶
Redshift |
Snowflake |
Notes |
|---|---|---|
VARCHAR |
VARCHAR |
VARCHAR holds Unicode UTF-8 characters. If no length is specified, the default is the maximum allowed length (16,777,216). |
CHAR |
CHAR |
Snowflake’s CHAR is an alias for VARCHAR. |
CHARACTER |
CHARACTER |
Snowflake’s CHARACTER is an alias for VARCHAR. |
NCHAR |
NCHAR |
Snowflake’s NCHAR is an alias for VARCHAR. |
BPCHAR |
VARCHAR |
BPCHAR data type is not supported in Snowflake. VARCHAR is used instead. For more information please refer to SSC-FDM-PG0002. |
NVARCHAR |
NVARCHAR |
Snowflake’s NVARCHAR is an alias for VARCHAR. |
CHARACTER VARYING |
CHARACTER VARYING |
Snowflake’s CHARACTER VARYING is an alias for VARCHAR. |
NATIONAL CHARACTER |
NCHAR |
Snowflake’s NCHAR is an alias for VARCHAR. |
NATIONAL CHARACTER VARYING |
NCHAR VARYING |
Snowflake’s NCHAR VARYING is an alias for VARCHAR. |
TEXT |
TEXT |
Snowflake’s TEXT is an alias for VARCHAR. |
NAME (Special character type) |
VARCHAR |
VARCHAR holds Unicode UTF-8 characters. If no length is specified, the default is the maximum allowed length (16,777,216). |
Note
When the MAX precision argument is present in the Redshift data types, they are transformed to the default max precision supported by Snowflake.
Boolean Types ¶
Redshift |
Snowflake |
Notes |
|---|---|---|
BOOL |
BOOLEAN |
|
BOOLEAN |
BOOLEAN |
Binary Data Types ¶
Redshift |
Snowflake |
Notes |
|---|---|---|
VARBYTE |
VARBINARY |
VARBINARY is synonymous with BINARY. |
VARBINARY |
VARBINARY |
VARBINARY is synonymous with BINARY. |
BINARY |
BINARY |
The maximum length is 8 MB (8,388,608 bytes) |
BINARY VARYING |
BINARY VARYING |
BINARY VARYING is synonymous with BINARY. |
Warning
The maximum length for binary types in Redshift is 16 MB (16,777,216 bytes), however in Snowflake it is 8 MB (8,388,608 bytes). Please consider this reduction in the maximum length.
Date & Time Data Types ¶
Redshift |
Snowflake |
Notes |
|---|---|---|
DATE |
DATE |
DATE accepts dates in the most common forms (such as |
TIME |
TIME |
Storing times in the form of |
TIMETZ |
TIME |
Time zone not supported for time data type. For more information please refer to SSC-FDM-0005. |
TIME WITH TIME ZONE |
TIME |
Time zone not supported for time data type. For more information please refer to SSC-FDM-0005. |
TIME WITHOUT TIME ZONE |
TIME |
Snowflake supports a single TIME data type for storing times in the form of |
TIMESTAMP |
TIMESTAMP |
Timestamp precision can range from 0 (seconds) to 9 (nanoseconds). |
TIMESTAMPTZ |
TIMESTAMP_TZ |
TIMESTAMP_TZ internally stores UTC time together with an associated time zone offset. |
TIMESTAMP WITH TIME ZONE |
TIMESTAMP_TZ |
TIMESTAMP_TZ internally stores UTC time together with an associated time zone offset. |
TIMESTAMP WITHOUT TIME ZONE |
TIMESTAMP_NTZ |
TIMESTAMP_NTZ internally stores “wallclock” time with a specified precision. |
INTERVAL YEAR TO MONTH |
VARCHAR |
The interval data type is not supported by Snowflake. Transformed to VARCHAR. |
INTERVAL DAY TO SECOND |
VARCHAR |
The interval data type is not supported by Snowflake. Transformed to VARCHAR. |
Other data types ¶
Redshift |
Snowflake |
Notes |
|---|---|---|
GEOMETRY |
GEOMETRY |
The coordinates are represented as pairs of real numbers (x, y). Currently, only 2D coordinates are supported. |
GEOGRAPHY |
GEOGRAPHY |
The GEOGRAPHY data type follows the WGS 84 standard. |
HLLSKETCH |
N/A |
Data type not supported in Snowflake. For more information please refer to SSC-EWI-RS0004. |
SUPER |
VARIANT |
Can contain a value of any other data type, including OBJECT and ARRAY values. |
INTERVAL DAY TO SECOND Data Type¶
Description¶
INTERVAL DAY TO SECOND specify an interval literal to define a duration in days, hours, minutes, and seconds. (RedShift SQL Language Reference Interval data type)
There is no equivalent for this data type in Snowflake, it is currently transformed to VARCHAR.
Grammar Syntax ¶
Warning
The use of the Interval data type is planned for implementation in future updates.
Sample Source Patterns¶
Interval Day to Second in Create Table¶
Input¶
Redshift¶
Output¶
Snowflake¶
The Interval value is transformed to a supported Snowflake format and then inserted as text inside the column. Since Snowflake does not support Interval as a data type, it is only supported in arithmetic operations. To use the value, it needs to be extracted and used as an Interval constant (if possible).
Original Redshift value: INTERVAL '1 2:3:4.567' DAY TO SECOND
Value stored in Snowflake column: '1days, 2hours, 3mins, 4secs, 56ms'
Value as Snowflake Interval constant: INTERVAL '1days, 2hours, 3mins, 4secs, 56ms'
Retrieving data from an Interval Day to Second column¶
Input¶
Redshift¶
Result¶
interval_day_col1 |
interval_day_col2 |
|---|---|
1 days 2 hours 0 mins 0.0 secs |
NULL |
NULL |
1 days 2 hours 3 mins 4.56 secs |
Output¶
Snowflake¶
Result¶
interval_day_col1 |
interval_day_col2 |
|---|---|
1d, 2h |
NULL |
NULL |
1d, 2h, 3m, 4s, 56ms |
Known Issues¶
1. Only arithmetic operations are supported¶
Snowflake Intervals have several limitations. Only arithmetic operations between DATE or TIMESTAMP and Interval Constants are supported, every other scenario is not supported.
Related EWIs¶
SSC-EWI-0036: Data type converted to another data type.
INTERVAL YEAR TO MONTH Data Type¶
Description¶
INTERVAL YEAR TO MONTH specify an interval data type to store a duration of time in years and months. (RedShift SQL Language Reference Interval data type)
There is no equivalent for this data type in Snowflake, it is currently transformed to VARCHAR.
Grammar Syntax ¶
Warning
The use of the Interval data type is planned for implementation in future updates.
Sample Source Patterns¶
Interval Year To Month in Create Table¶
Input:¶
Redshift¶
Output¶
Snowflake¶
The Interval value is transformed to a supported Snowflake format and then inserted as text inside the column. Since Snowflake does not support Interval as a data type, it is only supported in arithmetic operations. To use the value, it needs to be extracted and used as an Interval constant (if possible).
Original Redshift value: INTERVAL '1-2' YEAR TO MONTH
Value stored in Snowflake column: '1y, 2m'
Value as Snowflake Interval constant: INTERVAL '1y, 2m'
Retrieving data from an Interval Year To Month column¶
Input¶
Redshift¶
Result¶
interval_year_col1 |
interval_year_col2 |
interval_year_col2 |
|---|---|---|
12 years 0 mons |
NULL |
NULL |
NULL |
0 years 5 mons |
NULL |
NULL |
NULL |
1000 years 11 mons |
Output¶
Snowflake¶
Result¶
interval_year_col1 |
interval_year_col2 |
interval_year_col2 |
|---|---|---|
12 y 0 mm |
NULL |
NULL |
NULL |
0 y 5 mm |
NULL |
NULL |
NULL |
1000 y 11 mons |
Known Issues¶
1. Only arithmetic operations are supported¶
Snowflake Intervals have several limitations. Only arithmetic operations between DATE or TIMESTAMP and Interval Constants are supported, every other scenario is not supported.
Related EWIs¶
SSC-EWI-0036: Data type converted to another data type.
Numeric Format Models¶
Description¶
These are the different Numeric Formats supported by Redshift and its equivalent in Snowflake.
Redshift |
Snowflake |
Comments |
|---|---|---|
0 |
0 |
|
9 |
9 |
|
. (period), D |
. (period), D |
|
, (comma) |
, (comma) |
|
CC |
Currently there is no equivalent for Century Code in Snowflake. |
|
FM |
FM |
|
PR |
Currently there is no equivalent for this format in Snowflake. |
|
S |
S |
Explicit numeric sign. |
L |
$ |
Currency symbol placeholder. |
G |
G |
|
MI |
MI |
Minus sign (for negative numbers) |
PL |
S |
Currently there is no equivalent for plus sign in Snowflake. So it is translated to the explicit numeric sign. |
SG |
S |
Explicit numeric Sign in the specified position. |
RN |
Currently there is no equivalent for Roman Numerals in Snowflake. |
|
TH |
Currently there is no equivalent for Ordinal suffix in Snowflake |
Sample Source Patterns¶
Uses in To_Number function¶
Input:¶
Redshift¶
Results¶
| multiple_nines | exact_zeros | decimals | fill_mode | currency |
|---|---|---|---|---|
| 9423 | 9423 | 123.456 | 123031.30 | 1254.88 |
Output¶
Snowflake¶
Results¶
| multiple_nines | exact_zeros | decimals | fill_mode | currency |
|---|---|---|---|---|
| 9423 | 9423 | 123.456 | 123031.300 | 12454.88 |
Input:¶
Redshift¶
Results¶
| currency_L | signed_number_end | plus_sign | minus_sign | signed_number |
|---|---|---|---|---|
| 12454.8 | -123 | 1254.88 | -12454.88 | -12454.88 |
Output:¶
Snowflake¶
Results¶
| currency_L | signed_number_end | plus_sign | minus_sign | signed_number |
|---|---|---|---|---|
| 12454.8 | -123 | 1254.88 | -12454.88 | -12454.88 |
Uses in To_Char function¶
Input:¶
Redshift¶
Results¶
| signed_number | decimal_number | negative | minus_sign | plus_sign | multiple_ninesmultiple_nines | exact_zerosexact_zeros |
|---|---|---|---|---|---|---|
| '123-' | '12,454.88' | '-12,454.88' | '12454.88' | '-12,454.88' | '09423' | '09423' |
Output:¶
Snowflake¶
Results¶
| signed_number | decimal_number | negative | minus_sign | plus_sign | multiple_ninesmultiple_nines | exact_zerosexact_zeros |
|---|---|---|---|---|---|---|
| '123-' | '12,454.88' | '-12,454.88' | '12454.88' | '-12,454.88' | '09423' | '09423' |
Unsupported format¶
The following format is not supported, for which it will be marked with an EWI.
Input:¶
Output:¶
Known Issues¶
1. Using numeric signs inside the number not supported.¶
When any numeric sign format (MI, SG or PL) is used inside the number, instead of at the start, or at the end of the number is not supported in snowflake
Example
Related EWIs¶
SSC-EWI-0006: The current date/numeric format may have a different behavior in Snowflake.