更新时间:2025-10-31 GMT+08:00

MySQL配置

设置MySQL配置参数可在迁移MySQL、BigQuery数据库脚本时自定义迁移工具的行为。

打开config文件夹中的features-mysql.properties文件,并根据实际需要设置features-mysql.properties文件中的配置参数中的参数。

表1 features-mysql.properties文件中的配置参数

参数

说明

取值范围

默认值

样例

  • table.databaseAsSchema
  • table.defaultSchema

是否使用数据库名称作为schema名称,如果数据库名称不存在,则使用用户定义schema, 如果用户定义schema为空,则使用默认schema。

  • true
  • false
  • public
  • true
  • public
  • table.databaseAsSchema=true
  • table.defaultSchema=public
  • table.schema

用户设置的schema名称,如果该参数不为空,则使用该参数,即使包含useDatabaseAsSchema = true,也会使用当前schema名称。

  • schemaName
  • 默认为空
  • table.schema=
  • table.orientation

默认数据存储方式,ROW:行存储,COLUMN:列存储。

  • ROW
  • COLUMN
  • ROW
  • table.orientation=ROW
  • table.type

默认的表类型,分区表、复制表、round-robin表。 REPLICATION、HASH、ROUND-ROBIN。

  • HASH
  • REPLICATION
  • ROUND-ROBIN
  • HASH
  • table.type=HASH
  • table.tablespace

表空间选项。

  • COMMENT
  • RESERVE
  • RESERVE
  • table.tablespace=RESERVE
  • table.partition-key.choose.strategy

分区键选择策略。

  • partitionKeyChooserStrategy
  • partitionKeyChooserStrategy
  • table.partition-key.choose.strategy=partitionKeyChooserStrategy
  • table.partition-key.name

分区键设置,如果为空,则按照默认策略选择,如果有多列,用逗号分隔,忽略列名称大小写。

  • 预留参数
  • 默认为空
  • table.partition-key.name=
  • table.compress.mode

创建新表时,需要在CREATE TABLE语句中指定关键字COMPRESS,这样,当对该表进行批量插入时就会触发压缩特性。该特性会在页范围内扫描所有元组数据,生成字典、压缩元组数据并进行存储。指定关键字NOCOMPRESS则不对表进行压缩。

  • COMPRESS
  • NOCOMPRESS
  • NOCOMPRESS
  • table.compress.mode=NOCOMPRESS
  • table.compress.row

  • table.compress.column

指定表数据的压缩级别,它决定了表数据的压缩比以及压缩时间。

  • YES
  • NO

  • YES
  • NO
  • LOW
  • MIDDLE
  • HIGH
  • NO

  • LOW
  • table.compress.row=NO

  • table.compress.column=LOW
  • table.compress.level

指定表数据同一压缩级别下的不同压缩水平,它决定了同一压缩级别下表数据的压缩比以及压缩时间。对同一压缩级别进行了更加详细的划分,为用户选择压缩比和压缩时间提供了更多的空间。总体来讲,此值越大,表示同一压缩级别下压缩比越大,压缩时间越长;反之亦然。

  • 0
  • 1
  • 2
  • 3
  • 0
  • table.compress.level=0
  • table.database.template

数据库模板。

  • 预留参数
  • template0

table.database.template=template0

  • table.database.encoding

A database code.

  • UTF8
  • SQL_ASCII
  • GBK
  • Latin1 codes
  • UTF8

table.database.encoding=UTF8

  • table.index.rename

创建索引时,是否重新命名索引名。

  • true
  • false
  • false

table.index.rename=false

  • table.database.onlyFullGroupBy

select后非聚合列是否全部出现在group by中。

  • true
  • false
  • true

table.database.onlyFullGroupBy=true

  • table.database.realAsFloat

REAL数据类型转换使用,默认false,转换为DOUBLE PRECISION;改为true时,转换为REAL。

  • true
  • false
  • false

table.database.realAsFloat=false

  • table.database.havingAddGroupBy

having clause语句是否添加GROUP BY。

  • true
  • false
  • true

table.database.havingAddGroupBy=true

  • table.function.uuid

uuid函数是否以原语句函数原样输出:

  • false:转为sys_uuid函数。
  • true:输出uuid函数。

默认false。

  • true
  • false
  • false

table.function.uuid=false

  • table.function.split

split 拆分函数:

  • 默认true:输出split函数。
  • false:转为split_part函数。
  • true
  • false
  • true

table.function.split=true

  • table.function.tryCast

try_cast函数是否以原语句函数原样输出。

  • 默认false:转为cast函数。
  • true:输出try_cast函数。
  • true
  • false
  • false

table.function.tryCast=false

  • table.sql.set.names

setNames语句是否注释,不转换。

  • 默认true:注释,不转换。
  • false:进行转换。
  • true
  • false
  • true

table.sql.set.names=true

  • table.sql.set.password

setPassword语句是否注释,不转换。

  • 默认true:注释,不转换。
  • false:进行转换。
  • true
  • false
  • true

table.sql.set.password=true

  • table.sql.set.resource.group

setResourceGroup语句是否注释,不转换。

  • 默认true:注释,不转换。
  • false:进行转换。
  • true
  • false
  • true

table.sql.set.resource.group=true

  • table.sql.set.role

setRole语句是否注释,不转换。

  • 默认true:注释,不转换。
  • false:进行转换。
  • true
  • false
  • true

table.sql.set.role=true

  • table.sql.set.variable

setVariable语句是否注释,不转换。

  • 默认true:注释,不转换。
  • false:进行转换。
  • true
  • false
  • true

table.sql.set.variable=true

  • sql.conversion.type

SQL文件的转换类型:ddl/plsql。

默认为ddl,当要执行存储过程或自定义函数时转换类型为plsql。

  • ddl
  • plsql
  • ddl

sql.conversion.type=ddl

  • table.insert.convert.upsert

插入时主键或唯一索引冲突的处理方式:

  • true (更新):当发生冲突时,用新数据更新已存在的记录。
  • false (忽略):当发生冲突时,放弃新数据,保留原有的记录。
  • true
  • false
  • false

table.insert.convert.upsert=false

  • table.alter.add.index

是否支持alter table ... add index转换。 默认false不转换, true转换。

  • true
  • false
  • false

table.alter.add.index=false

  • table.create.comment.constraint

是否注释多余的约束, 默认false不注释。

  • true
  • false
  • false

table.create.comment.constraint=false

  • table.create.type.set

是否对set类型增加check约束,默认false不增加。

  • true
  • false
  • false

table.create.type.set=false

  • table.create.type.enum

是否对enum类型增加 in not null约束,默认false不增加。

  • true
  • false
  • false

table.create.type.enum=false

  • table.create.columnCase

是否对列字段进行小写转换,默认为true,进行小写转换;false为与原sql保持大小写一致。

  • true
  • false
  • true

table.create.columnCase=true

  • table.option.colversion

指定列存存储格式的版本,默认值2.0,可选值 1.0、2.0、3.0。

  • 1.0
  • 2.0
  • 3.0
  • 2.0

table.option.colversion=2.0

  • table.origin.database.type

源数据库类型,包括bigquery、doris、 synapse、 mysql&adb,默认为mysql&adb。

  • bigquery
  • doris
  • synapse
  • mysql
  • adb
  • mysql&adb

table.origin.database.type = mysql

  • table.enable.hstore

是否允许hstore表,true/false(默认为空,false代表在语句中设置hstore为false)。

  • true
  • false
  • 默认为空

table.enable.hstore=

  • table.enable.hstore.opt

是否允许hstore_opt操作,true表示运行,false表示禁止。

  • true
  • false
  • true

table.enable.hstore.opt=true

  • table.partition.comment.enable

是否将partition的原始SQL输出为注释,true/false。

  • true
  • false
  • false

table.partition.comment.enable=false

  • table.type.schema.prefix

创建type时,type名称是否拼接schema名,true/false。

  • true
  • false
  • true

table.type.schema.prefix=true

  • table.option.partition.ttl

分区参数partition_expiration_days需要转为整数,指定四舍五入规则。

  • HALF_UP:四舍五入。
  • CEILING:向上取整。
  • FLOOR:向下取整。
  • HALF_UP
  • CEILING
  • FLOOR
  • HALF_UP

table.option.partition.ttl=HALF_UP