DTStack / chunjun

A data integration framework

Home Page:https://dtstack.github.io/chunjun/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature][ftp] sql模式下,支持指定字段的列索引,支持指定sheetNo工作表

libailin opened this issue · comments

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

sql模式下,
1、支持指定字段的列索引,
2、支持指定sheetNo工作表

Use case

CREATE TABLE SOURCE (
    id int
    ,username varchar
    ,remark varchar
) WITH (
    'connector' = 'ftp-x',
     'path' = '/数据部/计算组',
    -- 服务器访问协议,目前支持ftp、sftp
    'protocol' = 'ftp',
    'host' = '127.0.0.1',
    -- 默认值:若传输协议是sftp协议,默认值是22;若传输协议是标准ftp协议,默认值是21
    'port' = '21',
    'username' = 'xxx',
    'password' = 'xxx',
    -- 文件的类型,和原生flink保持一致,支持原生所有类型。 读取的文件类型,默认取文件后缀名,支持CSV,TXT,EXCEL
    'format' = 'csv',
    -- protocol为ftp时的连接模式,可选PASV和PORT
    'connect-pattern' = 'PASV',
    -- 连接超时时间,单位毫秒
    'timeout' = '5000',
    -- isFirstLineHeader 首行是否为标题行,如果是则不读取第一行 默认值:false
    'first-line-header' = 'true',
    -- 读取的文件类型,默认取文件后缀名,支持CSV,TXT,EXCEL
    -- file-extension 旧参数名
--     'file-type' = 'CSV',
    'file-type' = 'EXCEL',
    -- 读取的字段分隔符 默认值:,
    'field-delimiter' = ',',
    -- 读取文件的编码配置 默认值:UTF-8
    'encoding' = 'UTF-8'
    -- 文件压缩类型,支持ZIP 默认值:无
--     ,'compress-type' = 'ZIP'

    -- 以下sql模式暂不支持的参数
    -- fileConfig 文件参数配置 csv文件是否进行trim:`"fileConfig":{"trimWhitespace":true}`

    -- 指定字段名要读取的列索引值,多个以逗号分割
    ,'column-index'='0,1,3'
    -- 指定excel sheet 工作表索引,多个以逗号分割
    ,'sheet-no'='0,2'
);

CREATE TABLE SINK (
    id int
    ,username varchar
    ,remark varchar
) WITH (
    'connector' = 'stream-x',
    'print' = 'true'
);


INSERT INTO SINK
SELECT *
FROM SOURCE;

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct