MySQL
To generate MySQL data, make sure to specify the dialect
as mysql
in your data plan file.
mysql.plan.yaml
name: "mysql_type_map_plan"
dialect: "mysql"
Supported Data Types
The supported data types for MySQL are:
MySQL Data Type | Mapped Type |
---|---|
BOOLEAN | number with values |
INT | number |
DECIMAL | number with constraints |
FLOAT | number with constraints |
DOUBLE | number with constraints |
DATE | date |
TIME | time |
DATETIME | datetime |
TIMESTAMP | datetime |
CHAR | text with constraints |
VARCHAR | text with constraints |
TEXT | text |
ENUM | text with values |
Sample Data Order To generate data for the following table, you can use the schema and plan file below.
Sample MySQL Data Type Table
CREATE TABLE `hw`.`mysql_type_map` (
`my_bool` TINYINT NOT NULL,
`my_int` INT NOT NULL,
`my_decimal` DECIMAL(4,2) NOT NULL,
`my_float` FLOAT NOT NULL,
`my_double` DOUBLE NOT NULL,
`my_date` DATE NOT NULL,
`my_datetime` DATETIME NOT NULL,
`my_timestamp` TIMESTAMP NOT NULL,
`my_time` TIME NOT NULL,
`my_char` CHAR(10) NOT NULL,
`my_vchar` VARCHAR(45) NOT NULL,
`my_text` TEXT(100) NOT NULL,
`my_enum` ENUM('item1', 'item2', 'item3') NOT NULL);
BOOLEAN
MySQL BOOLEAN data type is mapped by a number data type with values constraint.
- Define Boolean Field
- Set Boolean Values
Define Boolean Field
properties:
- name: "my_bool"
type: "number"
Configure two boolean values
properties:
- name: "my_bool"
values:
- values:
- 0
- 1
weight: 1.0
INT
MySQL INT data type is mapped by a number data type.
Define INT value between 0 and 99999
properties:
- name: "my_int"
type: "number"
constraints:
- type: "range"
min: 0
max: 99999