Mapping Between MySQL and ClickHouse Field Types
DataArts Migration converts the source field type to the destination field type based on the default rule, and creates tables and synchronizes data in real time.
Field Type Mapping Rules
The following table lists the field types supported by a job that migrates data from MySQL to ClickHouse.
| Type | MySQL Data Type | ClickHouse Data Type | Description |
|---|---|---|---|
| String | CHAR(M) | FixedString | This type is used for strings with a specified length. Null bytes are used to fill the end characters. |
| VARCHAR(M) | String | A string can be of a random length. It can contain any set of bytes, including empty bytes. Therefore, the string type can replace the VARCHAR, BLOB, and CLOB types in other DBMSs. | |
| Number | BOOLEAN | UInt8 | ClickHouse does not support the Boolean type. You can use the UInt8 type for Boolean values. Valid values are 0 and 1. |
| TINYINT | Int8 | Value range: –128 to 127 | |
| TINYINT UNSIGNED | UInt8 | Value range: 0 to 255 | |
| SMALLINT | Int16 | Value range: –32768 to 32767 | |
| SMALLINT UNSIGNED | UInt16 | Value range: 0 to 65535 | |
| MEDIUMINT | Int32 | Value range: –2147483648 to 2147483647 | |
| MEDIUMINT UNSIGNED | UInt32 | Value range: 0 to 4294967295 | |
| INT | Int32 | Value range: –2147483648 to 2147483647 | |
| INT UNSIGNED | UInt32 | Value range: 0 to 4294967295 | |
| BIGINT | Int64 | Value range: –9223372036854775808 to 9223372036854775807 | |
| BIGINT UNSIGNED | UInt64 | Value range: 0 to 18446744073709551615 | |
| REAL | - | - | |
| DECIMAL(M,D) | Decimal(P, S) | A signed fixed-point number that can ensure precision during addition, subtraction, and multiplication operations. The following formats are supported:
| |
| NUMERIC | - | - | |
| FLOAT(M,D) | Float32 | The size is 4 bytes, and the valid precision is 7 digits. | |
| DOUBLE(M,D) | Float64 | The size is 8 bytes, and the valid precision is 16 digits. | |
| DOUBLE PRECISION | - | - | |
| Bit | BIT(M) | - | Unsupported for ClickHouse |
| Date and time | DATE | Date | A Date value takes up two bytes, indicating the date value from 1970-01-01 (unsigned) to the current time. Date values are stored without the time zone. |
| TIME | - | - | |
| DATETIME | - | - | |
| TIMESTAMP | DateTime64 | It includes the hour, minute, second, and subsecond, and can be inserted in the string format. The minimum value is 1970-01-01 00:00:00. The system time zone will be used when the client or server is started. | |
| YEAR(M) | - | - | |
| Multimedia (binary) | BINARY(M) | String | - |
| VARBINARY(M) | String | - | |
| TEXT | String | - | |
| TINYTEXT | String | - | |
| MEDIUMTEXT | String | - | |
| LONGTEXT | String | - | |
| BLOB | String | - | |
| TINYBLOB | String | - | |
| MEDIUMBLOB | String | - | |
| LONGBLOB | String | - | |
| Special type | SET | - | - |
| JSON | JSON | Supported in 22.8 and later versions | |
| ENUM | Enum | - |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot