Skip to main content

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 TypeMapped Type
BOOLEANnumber with values
INTnumber
DECIMALnumber with constraints
FLOATnumber with constraints
DOUBLEnumber with constraints
DATEdate
TIMEtime
DATETIMEdatetime
TIMESTAMPdatetime
CHARtext with constraints
VARCHARtext with constraints
TEXTtext
ENUMtext 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.

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