Home > Net >  MSSQL to Snowflake Data Type Mapping
MSSQL to Snowflake Data Type Mapping

Time:09-15

Does anyone have a data type mapping from MSSQL (Azure MSSQL) to Snowflake?

This is the current mapping I have:

# Key: MSSQL, value: Snowflake
DATA_TYPE_MAPPING = {
  "BIGINT": "BIGINT",
  "BINARY": "BLOB",
  "BIT": "BOOLEAN",
  "DATE": "DATE",
  "DATETIME": "DATETIME",
  "DATETIME2": "DATETIME",
  "DOUBLE": "DOUBLE",
  "DECIMAL": "DECIMAL",
  "FLOAT": "FLOAT",
  "ENUM": "STRING",
  "SET": "STRING",
  "IMAGE": "BINARY",
  "INT": "INT",
  "INTEGER": "INTEGER",
  "LONGTEXT": "VARCHAR",
  "MEDIUMINT": "INTEGER",
  "MEDIUMTEXT": "VARCHAR",
  "NUMERIC": "NUMBER",
  "REAL": "FLOAT4",
  "SMALLINT": "SMALLINT",
  "TEXT": "VARCHAR",
  "TIME": "TIME",
  "TIMESTAMP": "TIMESTAMP",
  "TINYTEXT": "STRING",
  "TINYINT": "TINYINT",
  "VARCHAR": "VARCHAR",
  "VARBINARY": "VARBINARY",
}

I could not find a complete mapping. If someone knows about one, please let us know.

CodePudding user response:

The data type mapping is described in Microsoft SQL Server to Snowflake Migration Reference Manual

Appendix A: MICROSOFT SQL SERVER TO SNOWFLAKE FEATURE MAPPING

Subsection: Data Types

CodePudding user response:

After looking at the manual Microsoft SQL Server to Snowflake Migration Reference Manual mentioned in this post I have changed the initial mapping to:

MSSQL_SNOWFLAKE_DATA_TYPE_MAPPING = {
  "BIGINT": "NUMBER",
  "BINARY": "BINARY",
  "BIT": "BOOLEAN",
  "CHAR": "VARCHAR(1)",
  "DATE": "DATE",
  "DATETIME": "DATETIME",
  "DATETIME2": "TIMESTAMP_NTZ",
  "DATETIMEOFFSET": "TIMESTAMP_LTZ",
  "DOUBLE": "DOUBLE",
  "DECIMAL": "NUMBER",
  "FLOAT": "FLOAT",
  "ENUM": "STRING",
  "SET": "STRING",
  "IMAGE": "BINARY",
  "INT": "NUMBER",
  "INTEGER": "INTEGER",
  "LONGTEXT": "VARCHAR",
  "MEDIUMINT": "INTEGER",
  "MEDIUMTEXT": "VARCHAR",
  "MONEY": "NUMBER",
  "NCHAR": "VARCHAR",
  "NVARCHAR": "VARCHAR",
  "NTEXT": "VARCHAR",
  "NUMERIC": "NUMBER",
  "REAL": "FLOAT",
  "SMALLDATETIME": "DATETIME",
  "SMALLINT": "NUMBER",
  "SMALLMONEY": "NUMBER",
  "TEXT": "VARCHAR",
  "TIME": "TIME",
  "TIMESTAMP": "TIMESTAMP_NTZ",
  "TINYTEXT": "STRING",
  "TINYINT": "NUMBER",
  "VARCHAR": "VARCHAR",
  "VARBINARY": "BINARY",
}
  • Related